Module: Mongoid::Extensions::BigDecimal
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Defined in: | lib/mongoid/extensions/big_decimal.rb |
Overview
Adds type-casting behavior to BigDecimal
class.
Class Method Summary
-
.included(base)
Internal use only
Internal use only
Behavior to be invoked when the module is included.
Instance Attribute Summary
-
#numeric? ⇒ true
readonly
Is the
BigDecimal
a number?
Instance Method Summary
- #__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.
Class Method Details
.included(base)
This method is for internal use only.
Behavior to be invoked when the module is included.
# File 'lib/mongoid/extensions/big_decimal.rb', line 13
def self.included(base) base.extend(ClassMethods) end
Instance Attribute Details
#numeric? ⇒ true
(readonly)
Is the BigDecimal
a number?
# File 'lib/mongoid/extensions/big_decimal.rb', line 46
def numeric? true end
Instance Method Details
#__to_inc__ ⇒ Float
Deprecated.
Convert the big decimal to an $inc-able value.
# 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.
# File 'lib/mongoid/extensions/big_decimal.rb', line 36
def mongoize ::BigDecimal.mongoize(self) end