Sha256: 905bad09fbc2b877a2a655040d26c0e3027d062da3139dd44e5355add613dddd

Contents?: true

Size: 509 Bytes

Versions: 11

Compression:

Stored size: 509 Bytes

Contents

class Numeric
  # Syntactic sugar for defining instances of the Quantity class.
  #
  # Enables quantities to be specified by using unit names, symbols or JScience
  # labels as argments on Numeric objects, e.g.
  #
  #   1.5.metre      is equivalent to Quantity. new 1.5, :metre
  #
  #   1000.t         is equivalent to Quantity. new 1000, :t
  #
  def method_missing(method, *args, &block)
    if unit = Unit.for(method.to_s)
      Quantify::Quantity.new self, unit
    else
      super
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
quantify-3.1.2 lib/quantify/core_extensions/numeric.rb
quantify-3.1.1 lib/quantify/core_extensions/numeric.rb
quantify-3.1.0 lib/quantify/core_extensions/numeric.rb
quantify-3.0.0 lib/quantify/core_extensions/numeric.rb
quantify-2.0.2 lib/quantify/core_extensions/numeric.rb
quantify-2.0.1 lib/quantify/core_extensions/numeric.rb
quantify-2.0.0 lib/quantify/core_extensions/numeric.rb
quantify-1.2.2 lib/quantify/core_extensions/numeric.rb
quantify-1.2.1 lib/quantify/core_extensions/numeric.rb
quantify-1.2.0 lib/quantify/core_extensions/numeric.rb
quantify-1.1.0 lib/quantify/core_extensions/numeric.rb