Method: Hash#to_ostruct
- Defined in:
- lib/standard/facets/ostruct/to_ostruct.rb
#to_ostruct ⇒ Object
Turns a hash into a generic object using an OpenStruct.
o = {'a' => 1}.to_ostruct
o.a #=> 1
16 17 18 |
# File 'lib/standard/facets/ostruct/to_ostruct.rb', line 16 def to_ostruct OpenStruct.new(self) end |