Sha256: f8b7b895a5ab7ce12983900e11813d37cf1fd8e38dc5c7549f7dfb29e60b6db3
Contents?: true
Size: 540 Bytes
Versions: 10
Compression:
Stored size: 540 Bytes
Contents
require 'bigdecimal' module Attributor class BigDecimal < Numeric def self.native_type return ::BigDecimal end def self.example(context=nil, **options) return ::BigDecimal.new("#{/\d{3}/.gen}.#{/\d{3}/.gen}") end def self.load(value,context=Attributor::DEFAULT_ROOT_CONTEXT, **options) return nil if value.nil? return value if value.is_a?(self.native_type) if value.kind_of?(::Float) return BigDecimal(value, 10) end return BigDecimal(value) end end end
Version data entries
10 entries across 10 versions & 1 rubygems