Class: Convertable::Units::Month

Inherits:
SimpleUnit show all
Defined in:
lib/convertable/units.rb

Class Method Summary collapse

Methods inherited from SimpleUnit

to_json

Class Method Details

.convert_to(magnitude, new_unit) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/convertable/units.rb', line 61

def self.convert_to(magnitude, new_unit)
  if new_unit == Month
    magnitude
  elsif new_unit == Year
    magnitude / 12
  else
    raise UnsupportedConversion
  end
end