Method: Quantify::Quantity#initialize
- Defined in:
- lib/quantify/quantity.rb
#initialize(value, unit) ⇒ Quantity
Initialize a new Quantity object. Two arguments are required: a value and a unit. The unit can be a an instance of Unit::Base or the name, symbol or JScience label of a known (or derivable through know units and prefixes) unit
87 88 89 90 |
# File 'lib/quantify/quantity.rb', line 87 def initialize(value, unit) @value = value.to_f @unit = Unit.for(unit) end |