Module: Mongoid::Extensions::BigDecimal::ClassMethods
- Defined in:
- build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb
Instance Method Summary collapse
-
#demongoize(object) ⇒ BigDecimal?
Convert the object from its mongo friendly ruby type to this type.
-
#mongoize(object) ⇒ String?
Mongoize an object of any type to how it’s stored in the db as a String.
Instance Method Details
#demongoize(object) ⇒ BigDecimal?
Convert the object from its mongo friendly ruby type to this type.
57 58 59 |
# File 'build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb', line 57 def demongoize(object) object && object.numeric? ? BigDecimal(object.to_s) : nil end |
#mongoize(object) ⇒ String?
Mongoize an object of any type to how it’s stored in the db as a String.
71 72 73 |
# File 'build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb', line 71 def mongoize(object) object && object.numeric? ? object.to_s : nil end |