class Ardm::Property::Decimal

Constants

DEFAULT_PRECISION
DEFAULT_SCALE

Public Class Methods

new(model, name, options = {}) click to toggle source
Calls superclass method
# File lib/ardm/property/decimal.rb, line 18
def initialize(model, name, options = {})
  super

  [ :scale, :precision ].each do |key|
    unless @options.key?(key)
      warn "options[#{key.inspect}] should be set for #{self.class}, defaulting to #{send(key).inspect} (#{caller.first})"
    end
  end

  unless @scale >= 0
    raise ArgumentError, "scale must be equal to or greater than 0, but was #{@scale.inspect}"
  end

  unless @precision >= @scale
    raise ArgumentError, "precision must be equal to or greater than scale, but was #{@precision.inspect} and scale was #{@scale.inspect}"
  end
end