Class: MyOpenStruct
- Defined in:
- lib/poolparty/core/my_open_struct.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
Returns the value of attribute keys.
Instance Method Summary collapse
-
#initialize(h) ⇒ MyOpenStruct
constructor
A new instance of MyOpenStruct.
- #to_hash ⇒ Object
Constructor Details
#initialize(h) ⇒ MyOpenStruct
Returns a new instance of MyOpenStruct.
7 8 9 10 |
# File 'lib/poolparty/core/my_open_struct.rb', line 7 def initialize(h) @keys = h.keys super end |
Instance Attribute Details
#keys ⇒ Object
Returns the value of attribute keys.
6 7 8 |
# File 'lib/poolparty/core/my_open_struct.rb', line 6 def keys @keys end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/poolparty/core/my_open_struct.rb', line 11 def to_hash m = {} @keys.map do |key| m.update( {key => self.send(key)} ) end m end |