Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/geo_point/core_extension.rb
Instance Method Summary collapse
Instance Method Details
#to_lat ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/geo_point/core_extension.rb', line 18 def to_lat raise "Array must contain at least one element to return the latitude" if empty? case GeoPoint.coord_mode when :lng_lat self[1].to_lat else first.to_lat end end |
#to_lat_lng ⇒ Object
38 39 40 41 |
# File 'lib/geo_point/core_extension.rb', line 38 def to_lat_lng raise "Array must contain at least two elements to be converted to latitude and longitude" if !(size >= 2) [first.to_lat, self[1].to_lng] end |
#to_lng ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/geo_point/core_extension.rb', line 28 def to_lng raise "Array must contain at least two elements to return the longitude" if !self[1] case GeoPoint.coord_mode when :lng_lat first.to_lng else self[1].to_lng end end |
#to_lng_lat ⇒ Object
43 44 45 46 |
# File 'lib/geo_point/core_extension.rb', line 43 def to_lng_lat to_lat_lng.reverse # [first.to_lng, self[1].to_lat] end |