Sha256: 741eaf812672d4ddfa329f3b4b4a436aaae2336fb6384eec376ee8dc8b8cebfa

Contents?: true

Size: 543 Bytes

Versions: 4

Compression:

Stored size: 543 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Extensions
    module Hash
      extend ActiveSupport::Concern

      module ClassMethods
        def from_mongo(value)
          HashWithIndifferentAccess.new(value || {})
        end
      end

      def _mongo_mapper_deep_copy_
        self.class.new.tap do |new_hash|
          each do |key, value|
            new_hash[key._mongo_mapper_deep_copy_] = value._mongo_mapper_deep_copy_
          end
        end
      end
    end
  end
end

class Hash
  include MongoMapper::Extensions::Hash
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/extensions/hash.rb
mongo_mapper-0.15.6 lib/mongo_mapper/extensions/hash.rb
mongo_mapper-0.15.5 lib/mongo_mapper/extensions/hash.rb
mongo_mapper-0.15.4 lib/mongo_mapper/extensions/hash.rb