Sha256: 4371665a404efc313b8803cc2d31a7f0b3bf1e3b5ef0e65816751d5312b51541

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 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 

  def to_lat
    raise "Array must contain at least one element to return the latitude" if empty?
    first.to_lat
  end

  def to_lng
    raise "Array must contain at least two elements to return the longitude" if !self[1]
    self[1].to_lng
  end
  
  def trim
    join.trim
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geo_calc-0.7.4 lib/geo_calc/extensions/array.rb