Figured it out,
def self.attr_list
[:x1, :y1, :x2, :y2]
end
attr_accessor *attr_list
Explanation:
As attr_accessor is a method call which expects parameters list. So we can not pass array as it is. (*) will convert array into parameters list.
Just need to define a class method returning array of attribute list passed to attr_accessor.
Works well with attr_accessible(or anything similar) as well.