Class: Height::Units::Centimeters

Inherits:
Base
  • Object
show all
Defined in:
lib/height/units/centimeters.rb

Instance Attribute Summary

Attributes inherited from Base

#value

Instance Method Summary collapse

Methods inherited from Base

#*, #+, #-, #/, #<=>, #initialize, round_value, #to_unit

Constructor Details

This class inherits a constructor from Height::Units::Base

Instance Method Details

#to_centimetersObject



10
11
12
# File 'lib/height/units/centimeters.rb', line 10

def to_centimeters
  self
end

#to_feetObject



22
23
24
# File 'lib/height/units/centimeters.rb', line 22

def to_feet
  to_inches.to_feet
end

#to_inchesObject



18
19
20
# File 'lib/height/units/centimeters.rb', line 18

def to_inches
  to_millimeters.to_inches
end

#to_metersObject



14
15
16
# File 'lib/height/units/centimeters.rb', line 14

def to_meters
  to_millimeters.to_meters
end

#to_millimetersObject



5
6
7
8
# File 'lib/height/units/centimeters.rb', line 5

def to_millimeters
  millimeters = value * MILLIMETERS_IN_CENTIMETER
  Millimeters.new(millimeters)
end

#to_sObject



26
27
28
# File 'lib/height/units/centimeters.rb', line 26

def to_s
  value.round.to_s
end