Module: DeepOpenStruct::KeyAccess
- Defined in:
- lib/deep_open_struct/key_access.rb
Overview
Enables the usage ‘[]` and `[]=`
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
7 8 9 |
# File 'lib/deep_open_struct/key_access.rb', line 7 def [](key) public_send(key) end |
#[]=(key, value) ⇒ Object
11 12 13 |
# File 'lib/deep_open_struct/key_access.rb', line 11 def []=(key, value) public_send("#{key}=", value.is_a?(Hash) ? self.class.new(value) : value) end |