Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/frontman/custom_struct.rb
Instance Method Summary collapse
Instance Method Details
#to_ostruct ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/frontman/custom_struct.rb', line 25 def to_ostruct arr = map do |k, v| if v.is_a? Array [k, v.map { |el| el.respond_to?(:to_ostruct) ? el.to_ostruct : el }] else [k, v.respond_to?(:to_ostruct) ? v.to_ostruct : v] end end CustomStruct.new(Hash[arr]) end |