Class: Convertable::Units::SquareMeter

Inherits:
SimpleUnit
  • Object
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



37
38
39
40
41
42
43
44
45
# File 'lib/convertable/units.rb', line 37

def self.convert_to(magnitude, new_unit)
  if new_unit == SquareMeter
    magnitude
  elsif new_unit == SquareFoot
    magnitude * 10.7639
  else
    raise UnsupportedConversion
  end
end