-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconcepts.rb
40 lines (29 loc) · 869 Bytes
/
concepts.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# http://apidock.com/ruby/OpenStruct
require 'ostruct'
class Cartographer
class Config < OpenStruct
end
end
class Cartographer
def self.config(reload = false)
@config = nil if (reload)
@config ||= Cartographer::Config.new
end
end
Cartographer::Config.assign do |config|
config.provider = :google
end
Cartographer.config.provider = :google
location =
Cartographer.locate do |locator|
locator.address = '123 Main St'
locator.city = 'Toronto'
end
location = Cartographer.locate(:address => '123 Main St.', :city => 'Toronto')
begin
location = Cartographer.locate!(:address => '123 Main St.', :city => 'Toronto')
rescue Cartographer::LocationNotFound
# ...
end
location = Cartographer.locate(:address => '123 Main St.', :origin => home_location)
locations = Cartographer.locate_all(:address => '123 Main St.', :country => 'CA')