Class: Ziptz
- Inherits:
-
Object
- Object
- Ziptz
- Defined in:
- lib/ziptz.rb
Constant Summary collapse
- VERSION =
'3.0.11'.freeze
Class Method Summary collapse
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
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/ziptz.rb', line 7 def self.instance @instance ||= new end |
Instance Method Details
#inspect ⇒ Object
37 38 39 |
# File 'lib/ziptz.rb', line 37 def inspect "#<#{self.class}:#{object_id}>" end |
#time_zone_name(zip) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ziptz.rb', line 11 def time_zone_name(zip) tz_info = time_zone_info(zip) return unless tz_info tz_info[:tz] end |
#time_zone_offset(zip) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ziptz.rb', line 18 def time_zone_offset(zip) tz_info = time_zone_info(zip) return unless tz_info tzm_info = tzm[tz_info[:tz]] tzm_info[:offset] && tzm_info[:offset].to_i end |
#time_zone_uses_dst?(zip) ⇒ Boolean
26 27 28 29 30 31 |
# File 'lib/ziptz.rb', line 26 def time_zone_uses_dst?(zip) tz_info = time_zone_info(zip) return unless tz_info tz_info[:dst] end |
#zips(tz_name) ⇒ Object
33 34 35 |
# File 'lib/ziptz.rb', line 33 def zips(tz_name) tz.select { |_, v| v[:tz].downcase == tz_name.downcase }.keys end |