Module: Mongoid::Extensions::BigDecimal
- Defined in:
- lib/mongoid/extensions/big_decimal.rb
Overview
Adds type-casting behavior to BigDecimal class.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
private
Behavior to be invoked when the module is included.
Instance Method Summary collapse
- #__to_inc__ ⇒ Float deprecated Deprecated.
-
#mongoize ⇒ String | BSON::Decimal128 | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
-
#numeric? ⇒ true
Is the BigDecimal a number?.
Class Method Details
.included(base) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Behavior to be invoked when the module is included.
13 14 15 |
# File 'lib/mongoid/extensions/big_decimal.rb', line 13 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#__to_inc__ ⇒ Float
Deprecated.
Convert the big decimal to an $inc-able value.
24 25 26 |
# File 'lib/mongoid/extensions/big_decimal.rb', line 24 def __to_inc__ to_f end |
#mongoize ⇒ String | BSON::Decimal128 | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
36 37 38 |
# File 'lib/mongoid/extensions/big_decimal.rb', line 36 def mongoize ::BigDecimal.mongoize(self) end |
#numeric? ⇒ true
Is the BigDecimal a number?
46 47 48 |
# File 'lib/mongoid/extensions/big_decimal.rb', line 46 def numeric? true end |