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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs