Module: Mongoid::Criteria::Queryable::Extensions::BigDecimal::ClassMethods
Relationships & Source Files | |
Defined in: | lib/mongoid/criteria/queryable/extensions/big_decimal.rb |
Instance Method Summary
-
#evolve(object) ⇒ Object
Evolves the big decimal into a MongoDB friendly value.
Instance Method Details
#evolve(object) ⇒ Object
Evolves the big decimal into a MongoDB friendly value.
# File 'lib/mongoid/criteria/queryable/extensions/big_decimal.rb', line 24
def evolve(object) __evolve__(object) do |obj| return if obj.nil? case obj when ::BigDecimal if Mongoid.map_big_decimal_to_decimal128 BSON::Decimal128.new(obj) else obj.to_s end when BSON::Decimal128 then obj else if obj.numeric? if Mongoid.map_big_decimal_to_decimal128 BSON::Decimal128.new(object.to_s) else obj.to_s end else obj end end end end