is there any equivalent to this
class A
attr_accessor :foo, :bar
def initialize(options={}) options.each{|k,v| send("#{k}=", v)} end
end
I know that OpenStruct is very similar, but you don't get to define specific attributes.
is there any equivalent to this
class A
attr_accessor :foo, :bar
def initialize(options={}) options.each{|k,v| send("#{k}=", v)} end
end
I know that OpenStruct is very similar, but you don't get to define specific attributes.