Sha256: a81ab2e51eec07bb0b25d946faf8c1acd6fcf26838b8e72ea4c7b57a37f95c8f

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

require "bigdecimal"

require "active_support/core_ext/hash/indifferent_access"
require "active_support/inflector"

require "inflections"
require "units_converter/quantity_with_unit"
require "units_converter/version"

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

  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"),
    :furlong => BigDecimal.new("201.168"),
  }.with_indifferent_access
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
units_converter-0.0.2 lib/units_converter.rb