Class: Height::Units::Meters
- Inherits:
-
Base
- Object
- Base
- Height::Units::Meters
show all
- Defined in:
- lib/height/units/meters.rb
Instance Attribute Summary
Attributes inherited from Base
#value
Instance Method Summary
collapse
Methods inherited from Base
#*, #+, #-, #/, #<=>, #initialize, round_value, #to_s, #to_unit
Instance Method Details
#centimeters ⇒ Object
30
31
32
33
34
|
# File 'lib/height/units/meters.rb', line 30
def centimeters
millimeters = (to_millimeters.value - meters.to_millimeters.value)
Millimeters.new(millimeters).to_centimeters
end
|
#meters ⇒ Object
26
27
28
|
# File 'lib/height/units/meters.rb', line 26
def meters
Meters.new(value.floor)
end
|
#to_centimeters ⇒ Object
10
11
12
|
# File 'lib/height/units/meters.rb', line 10
def to_centimeters
to_millimeters.to_centimeters
end
|
#to_feet ⇒ Object
22
23
24
|
# File 'lib/height/units/meters.rb', line 22
def to_feet
to_inches.to_feet
end
|
#to_inches ⇒ Object
18
19
20
|
# File 'lib/height/units/meters.rb', line 18
def to_inches
to_centimeters.to_inches
end
|
#to_meters ⇒ Object
14
15
16
|
# File 'lib/height/units/meters.rb', line 14
def to_meters
self
end
|
#to_millimeters ⇒ Object
5
6
7
8
|
# File 'lib/height/units/meters.rb', line 5
def to_millimeters
millimeters = value * MILLIMETERS_IN_METER
Millimeters.new(millimeters)
end
|