lib/reality/extras/geonames.rb in reality-0.0.3 vs lib/reality/extras/geonames.rb in reality-0.0.4
- old
+ new
@@ -10,13 +10,15 @@
end
private
def guess_timezone
- Timezone::Configure.username = Reality.config.fetch('keys', 'geonames')
+ Timezone::Lookup.config(:geonames) do |c|
+ c.username = Reality.config.fetch('keys', 'geonames')
+ end
- gnzone = Timezone::Zone.new(latlon: [lat.to_f, lng.to_f])
- gnzone && TZInfo::Timezone.new(gnzone.zone)
+ gnzone = Timezone.lookup(lat.to_f, lng.to_f)
+ gnzone && TZInfo::Timezone.new(gnzone.name)
end
end
def self.included(reality)
reality.config.register('keys', 'geonames',