Class: DataMapper::Mongo::Property::Hash
- Inherits:
-
Property::Object
- Object
- Property::Object
- DataMapper::Mongo::Property::Hash
- Includes:
- Property::PassThroughLoadDump
- Defined in:
- lib/mongo_adapter/property/hash.rb
Instance Method Summary (collapse)
Instance Method Details
- (Object) load(value)
11 12 13 |
# File 'lib/mongo_adapter/property/hash.rb', line 11 def load(value) typecast_to_primitive(value) end |
- (Object) typecast_to_primitive(value)
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mongo_adapter/property/hash.rb', line 16 def typecast_to_primitive(value) case value when NilClass nil when ::Hash value.symbolize_keys when ::Array value.empty? ? {} : {value.first.to_sym => value.last} end end |