Sha256: 0b45f40ced9c753e0d1d99cfad83502af09b4512111e2d1a6a0d03fd6ed2d0c0
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
class Array def to_lat_lng raise "Array must contain at least two elements to be converted to latitude and longitude" if !(size >= 2) [to_lat, to_lng] end def to_lng_lat to_lat_lng.reverse end # Assumes by default that the order is lat, lng # If GeoPoint is defined, can reverse this order depending on #coord_mode class variable def to_lat raise "Array must contain at least one element to return the latitude" if empty? if defined?(GeoPoint) && GeoPoint.respond_to?(:coord_mode) && GeoPoint.coord_mode == :lng_lat self[1].to_lat else first.to_lat end end # see(#to_lat) def to_lng raise "Array must contain at least two elements to return the longitude" if !self[1] if defined?(GeoPoint) && GeoPoint.respond_to?(:coord_mode) && GeoPoint.coord_mode == :lng_lat first.to_lng else self[1].to_lng end end def trim join.trim end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_calc-0.7.5 | lib/geo_calc/extensions/array.rb |