Module: Mongoid::Extensions::Range::ClassMethods
- Defined in:
- lib/mongoid/extensions/range.rb
Instance Method Summary collapse
-
#demongoize(object) ⇒ Range
Convert the object from its mongo friendly ruby type to this type.
-
#mongoize(object) ⇒ Hash
Turn the object from the ruby type we deal with to a Mongo friendly type.
Instance Method Details
#demongoize(object) ⇒ Range
Convert the object from its mongo friendly ruby type to this type.
55 56 57 |
# File 'lib/mongoid/extensions/range.rb', line 55 def demongoize(object) object.nil? ? nil : ::Range.new(object["min"], object["max"]) end |
#mongoize(object) ⇒ Hash
Turn the object from the ruby type we deal with to a Mongo friendly type.
70 71 72 |
# File 'lib/mongoid/extensions/range.rb', line 70 def mongoize(object) object.nil? ? nil : { "min" => object.first, "max" => object.last } end |