Module: Mongoid::Extensions::BigDecimal

Defined in:
build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#__to_inc__Float

Convert the big decimal to an $inc-able value.

Examples:

Convert the big decimal.

bd.__to_inc__

Returns:

  • (Float)

    The big decimal as a float.

Since:

  • 3.0.3



16
17
18
# File 'build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb', line 16

def __to_inc__
  to_f
end

#mongoizeObject

Turn the object from the ruby type we deal with to a Mongo friendly type.

Examples:

Mongoize the object.

object.mongoize

Returns:

Since:

  • 3.0.0



29
30
31
# File 'build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb', line 29

def mongoize
  to_s
end

#numeric?true

Is the BigDecimal a number?

Examples:

Is the object a number?.

object.numeric?

Returns:

  • (true)

    Always true.

Since:

  • 6.0.0



41
42
43
# File 'build/mongoid-7.3/lib/mongoid/extensions/big_decimal.rb', line 41

def numeric?
  true
end