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