module Reality::Extras::Geonames::CoordTimezone

Public Instance Methods

timezone() click to toggle source
# File lib/reality/extras/geonames.rb, line 8
def timezone
  @timezone ||= guess_timezone
end

Private Instance Methods

guess_timezone() click to toggle source
# File lib/reality/extras/geonames.rb, line 14
def guess_timezone
  Timezone::Lookup.config(:geonames) do |c|
    c.username = Reality.config.fetch('keys', 'geonames')
  end
  
  gnzone = Timezone.lookup(lat.to_f, lng.to_f)
  gnzone && TZInfo::Timezone.new(gnzone.name)
end