Class: OpenStruct
- Inherits:
-
Object
- Object
- OpenStruct
- Defined in:
- lib/vps/core_ext/ostruct.rb
Class Method Summary collapse
Class Method Details
.to_hash(object, hash = {}) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vps/core_ext/ostruct.rb', line 2 def self.to_hash(object, hash = {}) case object when OpenStruct then object.each_pair do |key, value| hash[key.to_s] = to_hash(value) end hash when Array then object.collect do |value| to_hash(value) end else object end end |