Sha256: 017241d4332a028f5324b9f7bfd057f50a22d3ed674c42c00349cb0bfd543e6a

Contents?: true

Size: 387 Bytes

Versions: 4

Compression:

Stored size: 387 Bytes

Contents

module NumericCheckExt
  def is_numeric? arg
    arg.is_a? Numeric
  end
  alias_method :numeric?, :is_numeric?

  def check_numeric! arg
    raise ArgumentError, "Argument must be Numeric" if !is_numeric? arg
  end
end

module NumberDslExt
  def thousand
    self * 1000
  end

  def hundred
    self * 100
  end
end

[Float, Numeric].each do |mod|
  mod.send :include, NumberDslExt
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sugar-high-0.7.3 lib/sugar-high/numeric.rb
sugar-high-0.7.2 lib/sugar-high/numeric.rb
sugar-high-0.7.1 lib/sugar-high/numeric.rb
sugar-high-0.7.0 lib/sugar-high/numeric.rb