class MongoModel::Types::Hash

Public Instance Methods

from_mongo(hash) click to toggle source
# File lib/mongomodel/support/types/hash.rb, line 13
def from_mongo(hash)
  hash.with_indifferent_access if hash
end
to_mongo(hash) click to toggle source
# File lib/mongomodel/support/types/hash.rb, line 6
def to_mongo(hash)
  hash.inject({}) { |result, (k, v)|
    result[convert(k)] = convert(v)
    result
  } if hash
end