Sha256: 8583de2d61cea6f52d2496f5ae87236722435c4cbc03b75b6bf11bda3a7de6d9
Contents?: true
Size: 611 Bytes
Versions: 7
Compression:
Stored size: 611 Bytes
Contents
module Audited module Adapters module MongoMapper class AuditedChanges < ::Hash def self.from_mongo(changes) changes.is_a?(Hash) ? new.replace(changes) : changes end def self.to_mongo(changes) if changes.is_a?(Hash) changes.inject({}) do |memo, (key, value)| memo[key] = if value.is_a?(Array) value.map{|v| v.class.to_mongo(v) } else value end memo end else changes end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems