Class: OEXRWrapper::Object
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- OEXRWrapper::Object
- Defined in:
- lib/oexrwrapper/object.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Object
constructor
A new instance of Object.
- #to_ostruct(attributes) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Object
Returns a new instance of Object.
5 6 7 |
# File 'lib/oexrwrapper/object.rb', line 5 def initialize(attributes) super to_ostruct attributes end |
Instance Method Details
#to_ostruct(attributes) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/oexrwrapper/object.rb', line 9 def to_ostruct(attributes) case attributes when Hash OpenStruct.new(attributes.transform_values { |val| to_ostruct(val) }) when Array attributes.map { |o| to_ostruct(o) } else attributes end end |