Module: MongoHash

Defined in:
lib/ascension/to_json.rb

Instance Method Summary collapse

Instance Method Details

#as_json(*args) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/ascension/to_json.rb', line 48

def as_json(*args)
  res = {}
  each do |k,v| 
    v = v.as_json(*args) if v.respond_to?(:as_json)
    res[k.safe_to_mongo_hash.to_mongo_key] = v
  end
  res
end