# File lib/dm-core/property/decimal.rb, line 14 14: def initialize(model, name, options = {}) 15: super 16: 17: [ :scale, :precision ].each do |key| 18: unless @options.key?(key) 19: warn "options[#{key.inspect}] should be set for #{self.class}, defaulting to #{send(key).inspect} (#{caller.first})" 20: end 21: end 22: 23: unless @scale >= 0 24: raise ArgumentError, "scale must be equal to or greater than 0, but was #{@scale.inspect}" 25: end 26: 27: unless @precision >= @scale 28: raise ArgumentError, "precision must be equal to or greater than scale, but was #{@precision.inspect} and scale was #{@scale.inspect}" 29: end 30: end
Typecast a value to a BigDecimal
@param [#, #, Integer] value
value to typecast
@return [BigDecimal]
BigDecimal constructed from value
@api private
# File lib/dm-core/property/decimal.rb, line 41 41: def typecast_to_primitive(value) 42: if value.kind_of?(::Integer) 43: value.to_s.to_d 44: else 45: typecast_to_numeric(value, :to_d) 46: end 47: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.