Module: UnitsConverter

Defined in:
lib/units_converter.rb,
lib/units_converter/version.rb,
lib/units_converter/quantity_with_unit.rb

Defined Under Namespace

Classes: QuantityWithUnit

Constant Summary collapse

CONVERSIONS_TO_METRES =
{
  :metre => BigDecimal.new("1"),
  :kilometre => BigDecimal.new("1000"),
  :centimetre => BigDecimal.new("0.01"),
  :millimetre => BigDecimal.new("0.001"),
  :mile => BigDecimal.new("1609.344"),
  :yard => BigDecimal.new("0.9144"),
  :foot => BigDecimal.new("0.3048"),
  :inch => BigDecimal.new("0.0254"),
}.with_indifferent_access
VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.convert(quantity, unit) ⇒ Object



11
12
13
# File 'lib/units_converter.rb', line 11

def self.convert(quantity, unit)
  QuantityWithUnit.new(quantity, unit)
end