Class: Height::Units::Inches

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

Instance Attribute Summary

Attributes inherited from Base

#value

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

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

Instance Method Details

#to_centimetersObject



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

def to_centimeters
  to_millimeters.to_centimeters
end

#to_feetObject



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

def to_feet
  feet = value / Height::INCHES_IN_FOOT.to_f
  Feet.new(feet)
end

#to_inchesObject



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

def to_inches
  self
end

#to_metersObject



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

def to_meters
  to_centimeters.to_meters
end

#to_millimetersObject



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

def to_millimeters
  millimeters = value * Height::MILLIMETERS_IN_INCH
  Millimeters.new(millimeters)
end