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