lib/mongo_mapper/extensions/hash.rb in mongo_mapper-0.13.1 vs lib/mongo_mapper/extensions/hash.rb in mongo_mapper-0.14.0.rc1
- old
+ new
@@ -1,14 +1,26 @@
# encoding: UTF-8
module MongoMapper
module Extensions
module Hash
- def from_mongo(value)
- HashWithIndifferentAccess.new(value || {})
+ 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
- extend MongoMapper::Extensions::Hash
+ include MongoMapper::Extensions::Hash
end
\ No newline at end of file