Metamorphosis

An engine for allowing numeric values to convert between units.

Build Status Code Climate

Usage

Add 'metamorphosis' to your Gemfile,

Bundle install

Inside your intializer use the predefined units:

Metamorphosis.register_predefined_units

or register your own:

Metamorphosis.engine.register_unit(:wegowise, :british_thermal_units, 1)
Metamorphosis.engine.register_unit(:wegowise, :therms, 100_000)

Once you've defined your units you now have freedom to make your values more expressive:

value = 200_000.british_thermal_units #200000.0 british_thermal_units
value = value.to.therms
value == 2.therms  #true