-
Notifications
You must be signed in to change notification settings - Fork 12
/
where.rb
28 lines (25 loc) · 999 Bytes
/
where.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
require 'geocoder'
people = Hash.new
people["@alterisian"] = { location: "Málaga, Spain" }
people["@CelsoDeSa"] = { location: "Barra Velha, Brazil" }
people["@lucianghinda"] = { location: "Bucharest, Romania" }
people["@bsilva96"] = { location: "Machalí, Chile" }
people["@diazgdev"] = { location: "Aguascalientes, México" }
people["@esquinas"] = { location: "Málaga, Spain" }
people["@sidonath"] = { location: "Málaga, Spain" }
people["@firedev"] = { location: "Phuket, Thailand" }
people["@theOnlyMaDDogx"] = { location: "New Delhi, India" }
people["@georgy5"] = { location: "Kaufbeuren, Germany" }
people["@twobbler"] = { location: "Antwerp, Belgium" }
puts '{'
puts '"people": ['
people.each do |person, details|
results = Geocoder.search details[:location]
people[person][geo: results.first.coordinates]
puts '{ "name": "'+person+'",
"latitude": '+results.first.coordinates.first.to_s+',
"longitude": '+results.first.coordinates.last.to_s+'
},'
end
puts ' ] '
puts '}'