Class: Height::Units::Feet

Inherits:
Base
  • Object
show all
Defined in:
lib/height/units/feet.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

#feetObject



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

def feet
  self.class.new(value.floor)
end

#inchesObject



30
31
32
33
# File 'lib/height/units/feet.rb', line 30

def inches
  inches = value.modulo(1) * Height::INCHES_IN_FOOT
  Inches.new(inches)
end

#to_centimetersObject



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

def to_centimeters
  to_millimeters.to_centimeters
end

#to_feetObject



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

def to_feet
  self
end

#to_inchesObject



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

def to_inches
  inches = value * Height::INCHES_IN_FOOT
  Inches.new(inches)
end

#to_metersObject



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

def to_meters
  to_millimeters.to_meters
end

#to_millimetersObject



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

def to_millimeters
  to_inches.to_millimeters
end