Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/geo-distance/core_ext.rb
Instance Method Summary collapse
- #ceil_to(x) ⇒ Object
- #floor_to(x) ⇒ Object
- #round_to(x) ⇒ Object
- #rpd ⇒ Object (also: #to_radians)
Instance Method Details
#ceil_to(x) ⇒ Object
6 7 8 |
# File 'lib/geo-distance/core_ext.rb', line 6 def ceil_to(x) (self * 10**x).ceil.to_f / 10**x end |
#floor_to(x) ⇒ Object
10 11 12 |
# File 'lib/geo-distance/core_ext.rb', line 10 def floor_to(x) (self * 10**x).floor.to_f / 10**x end |
#round_to(x) ⇒ Object
2 3 4 |
# File 'lib/geo-distance/core_ext.rb', line 2 def round_to(x) (self * 10**x).round.to_f / 10**x end |
#rpd ⇒ Object Also known as: to_radians
14 15 16 |
# File 'lib/geo-distance/core_ext.rb', line 14 def rpd self * GeoDistance.radians_per_degree end |