class PushBot::Location

Attributes

lat[R]
lng[R]

Public Class Methods

new(lat, lng) click to toggle source
# File lib/push_bot/location.rb, line 5
def initialize(lat, lng)
  @lat = lat
  @lng = lng
end
parse(*location) click to toggle source
# File lib/push_bot/location.rb, line 10
def self.parse(*location)
  location.flatten!

  return location if location.size == 2
  location = location.first

  return [location.lat, location.lng] if location.respond_to?(:lat) && location.respond_to?(:lng)
  return [location.lat, location.lon] if location.respond_to?(:lat) && location.respond_to?(:lon)

  [location.latitude, location.longitude] if location.respond_to?(:latitude) && location.respond_to?(:longitude)
end