class Hash

Public Instance Methods

to_o() click to toggle source

Convert Hash to OpenStruct recursively coderwall.com/p/74rajw/convert-a-complex-nested-hash-to-an-object

# File lib/prelands_rails/concerns/hash.rb, line 8
def to_o
  JSON.parse to_json, object_class: OpenStruct
end
to_struct() click to toggle source
# File lib/prelands_rails/concerns/hash.rb, line 2
def to_struct
  Struct.new(*keys).new(*values)
end