Class: Struct
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
5 6 7 |
# File 'lib/lite/ruby/struct.rb', line 5 def [](key) send(key) end |
#[]=(key, val) ⇒ Object
9 10 11 |
# File 'lib/lite/ruby/struct.rb', line 9 def []=(key, val) send("#{key}=", val) end |
#attributes ⇒ Object
13 14 15 |
# File 'lib/lite/ruby/struct.rb', line 13 def attributes each_pair.with_object({}) { |(key, val), hash| hash[key] = val } end |
#replace(args) ⇒ Object
17 18 19 |
# File 'lib/lite/ruby/struct.rb', line 17 def replace(args) args.each_pair { |key, val| send("#{key}=", val) } end |