Class: DecimalToDegree
- Inherits:
-
Object
- Object
- DecimalToDegree
- Defined in:
- lib/decimal_to_degree.rb
Class Method Summary collapse
Class Method Details
.convert_latitude(input) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/decimal_to_degree.rb', line 2 def self.convert_latitude(input) d = input.to_i m = ( (input.to_f - d) * 60).to_i compass = input[0] == '-' ? 'S' : 'N' return "#{d}°#{m}'#{compass}" end |
.convert_longitude(input) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/decimal_to_degree.rb', line 10 def self.convert_longitude(input) d = input.to_i m = ( (input.to_f - d) * 60).to_i compass = input[0] == '-' ? 'W' : 'E' return "#{d}°#{m}'#{compass}" end |