Sha256: e6d5bba82cf6c5c4463aa26d904ff88b65c48e913f9f2947536ddbc6ff891cf7
Contents?: true
Size: 757 Bytes
Versions: 7
Compression:
Stored size: 757 Bytes
Contents
module GeoNamesAPI class TimeZone < SingletonEndpoint METHOD = "timezoneJSON" FIND_PARAMS = %w(lat lng radius date) def time_zone ActiveSupport::TimeZone.new(timezone_id) end def common_name ActiveSupport::TimeZone::MAPPING.key(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
7 entries across 7 versions & 1 rubygems