Class: OpenStruct
- Inherits:
-
Object
- Object
- OpenStruct
- Defined in:
- lib/openstruct-from_hash.rb
Class Method Summary collapse
Class Method Details
.from_hash(hash) ⇒ Object
3 4 5 6 7 |
# File 'lib/openstruct-from_hash.rb', line 3 def self.from_hash(hash) result = {} hash.each {|k,v| result[k] = Hash === v ? from_hash(v) : v } OpenStruct.new(result) end |