Sha256: cc93d4081854f543c4c8842432a656f354623840479e8c24f9b4aa5913ec49fb
Contents?: true
Size: 690 Bytes
Versions: 4
Compression:
Stored size: 690 Bytes
Contents
module GeoNamesAPI class TimeZone < GeoNamesAPI::Object METHOD = "timezoneJSON" ID = ["lat", "lng"] NESTED = false def time_zone ActiveSupport::TimeZone.new(timezone_id) end def local(time_type) t = DateTime.parse(send(time_type)) time_zone.local(t.year, t.month, t.day, t.hour, t.minute) end def utc(time_type) local(time_type).utc end def method_missing(method, *args) case method # Provides the local and utc time variant of each time # Examples: time_zone.sunrise_local, time_zone.time_utc when /\A(.*)_(local|utc)\Z/ send($2, $1) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems