class GoogleMapsAPI::Core::Coordinate

Attributes

lat[R]
lng[R]

Public Class Methods

from_array(array) click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 37
def self.from_array(array)
  self.new(array[0], array[1])
end
from_hash(hash) click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 33
def self.from_hash(hash)
  self.new(hash["lat"], hash["lng"])
end
new(lat, lng) click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 4
def initialize(lat, lng)
  @lat = lat.to_f
  @lng = lng.to_f
end

Public Instance Methods

latitude() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 9
def latitude
  lat
end
lon() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 17
def lon
  lng
end
longitude() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 13
def longitude
  lng
end
to_a() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 21
def to_a
  [lat, lng]
end
to_ary() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 25
def to_ary
  to_a
end
to_h() click to toggle source
# File lib/google_maps_api/core/coordinate.rb, line 29
def to_h
  {"lat" => lat, "lng" => lng}
end