class Numeric

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/active_decimal.rb, line 105
def method_missing(meth, *args, &block)

  if ActiveDecimal::BIG_NUMBERS[meth]
    val = self * ActiveDecimal::BIG_NUMBERS[meth]
    return val.to_i == val ? val.to_i : val
  end

  if ActiveDecimal::SINGULAR_SMALL_NUMBERS[meth]
    if self <= 1 and self > 0
      return Rational(self, ActiveDecimal::SINGULAR_SMALL_NUMBERS[meth])
    else
      raise ActiveDecimal::BadGrammar
    end
  end

  if ActiveDecimal::PLURAL_SMALL_NUMBERS[meth]
    if self > 1 or self <= 0
      return Rational(self, ActiveDecimal::PLURAL_SMALL_NUMBERS[meth])
    else
      raise ActiveDecimal::BadGrammar
    end
  end

  super
end