You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
340 B
17 lines
340 B
require_relative 'geocoder'
|
|
|
|
class Location
|
|
attr_accessor :name, :lat, :long, :geocoder
|
|
|
|
def initialize(name, lat=nil, long=nil, geocoder=Geocoder)
|
|
@name, @lat, @long, @geocoder = name, lat, long, geocoder
|
|
|
|
geocode! unless lat && long
|
|
end
|
|
|
|
def geocode!
|
|
self.name, self.lat, self.long = geocoder.geocode(name)
|
|
end
|
|
end
|
|
|