Class: Ziptz
- Inherits:
-
Object
- Object
- Ziptz
- Defined in:
- lib/ziptz.rb
Constant Summary collapse
- VERSION =
'2.0.9'.freeze
- TZ_INFO =
{ '0' => {name: 'APO/FPO (time zone unknown)', offset: 0}, '4' => {name: 'America/Puerto_Rico', offset: -4}, '5' => {name: 'America/New_York', offset: -5}, '6' => {name: 'America/Chicago', offset: -6}, '7' => {name: 'America/Denver', offset: -7}, '8' => {name: 'America/Los_Angeles', offset: -8}, '9' => {name: 'America/Anchorage', offset: -9}, '10' => {name: 'Pacific/Honolulu', offset: -10}, '11' => {name: 'Pacific/Pago_Pago', offset: -11}, '13' => {name: 'Pacific/Majuro', offset: 12}, '14' => {name: 'Pacific/Guam', offset: 10}, '15' => {name: 'Pacific/Palau', offset: 9}, '16' => {name: 'Pacific/Pohnpei', offset: 11} }.freeze
Instance Method Summary collapse
- #inspect ⇒ Object
- #time_zone_name(zip) ⇒ Object
- #time_zone_offset(zip) ⇒ Object
- #time_zone_uses_dst?(zip) ⇒ Boolean
- #zips(tz_name) ⇒ Object
Instance Method Details
#inspect ⇒ Object
41 42 43 |
# File 'lib/ziptz.rb', line 41 def inspect "#<#{self.class}:#{object_id}>" end |
#time_zone_name(zip) ⇒ Object
22 23 24 25 |
# File 'lib/ziptz.rb', line 22 def time_zone_name(zip) hash = time_zone_info(zip) hash && hash[:name] end |
#time_zone_offset(zip) ⇒ Object
27 28 29 30 |
# File 'lib/ziptz.rb', line 27 def time_zone_offset(zip) tz = time_zone_info(zip) tz && tz[:offset] end |
#time_zone_uses_dst?(zip) ⇒ Boolean
32 33 34 |
# File 'lib/ziptz.rb', line 32 def time_zone_uses_dst?(zip) dst[zip.to_s] end |
#zips(tz_name) ⇒ Object
36 37 38 39 |
# File 'lib/ziptz.rb', line 36 def zips(tz_name) tz_code = tz_name_to_code[tz_name.downcase] tz_code && zips_by_code(tz_code) end |