Class: Coercible::Coercer::Decimal
- Defined in:
- lib/coercible/coercer/decimal.rb
Overview
Coerce BigDecimal values
Constant Summary collapse
- FLOAT_FORMAT =
'F'.freeze
Constants inherited from Object
Object::COERCION_METHOD_REGEXP
Constants included from Options
Constants included from TypeLookup
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
-
#to_decimal(value) ⇒ Fixnum
Passthrough the value.
-
#to_string(value) ⇒ String
Coerce given value to String.
Methods inherited from Numeric
Methods inherited from Object
#coerced?, #initialize, #inspect, #to_array, #to_hash, #to_integer
Methods included from Options
#accept_options, #accepted_options, extended, #options
Methods included from TypeLookup
#determine_type, extended, #primitive
Constructor Details
This class inherits a constructor from Coercible::Coercer::Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Coercible::Coercer::Object
Instance Method Details
#to_decimal(value) ⇒ Fixnum
Passthrough the value
34 35 36 |
# File 'lib/coercible/coercer/decimal.rb', line 34 def to_decimal(value) value end |
#to_string(value) ⇒ String
Coerce given value to String
20 21 22 |
# File 'lib/coercible/coercer/decimal.rb', line 20 def to_string(value) value.to_s(FLOAT_FORMAT) end |