Sha256: 49570ac41d3058a2edd93cad978c131a9f232cdcf5d910d9c60d06d87cc9697f
Contents?: true
Size: 841 Bytes
Versions: 14
Compression:
Stored size: 841 Bytes
Contents
module Coercible class Coercer # Coerce BigDecimal values class Decimal < Numeric primitive ::BigDecimal FLOAT_FORMAT = 'F'.freeze # Coerce given value to String # # @example # coercer[BigDecimal].to_string(BigDecimal('1.0')) # => "1.0" # # @param [BigDecimal] value # # @return [String] # # @api public def to_string(value) value.to_s(FLOAT_FORMAT) end # Passthrough the value # # @example # Coercible::Coercion::BigDecimal.to_decimal(BigDecimal('1.0')) # => BigDecimal('1.0') # # @param [BigDecimal] value # # @return [Fixnum] # # @api public def to_decimal(value) value end end # class BigDecimal end # class Coercer end # module Coercible
Version data entries
14 entries across 12 versions & 4 rubygems