Class: Convertable::Units::Year

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



49
50
51
52
53
54
55
56
57
# File 'lib/convertable/units.rb', line 49

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