ziptz 3.0.12 → 3.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cb208aaaeb0ca6b9d67d832b367558984ea97586bdd7716e9bf18c8b7d74737
4
- data.tar.gz: 6861ea3b3a31cd3a5035dd28f85bf12805ce379d747d66093c8049c5900d6585
3
+ metadata.gz: 8584f30a48d305cf57165059fdf89bc90ff1169b540b07e4810dd08facf3bb76
4
+ data.tar.gz: 974d31d4c7ab3f17e7e5bf86d875eca5b29f9d44087a09ae9b83c4694fd68945
5
5
  SHA512:
6
- metadata.gz: e8491a763ae48d020b24f74be8be12fb73e22588ce53e40954cd5772f8903d802277418fee438beb1210b41ee168216cc4cd190336e7f5f52cc5b82d4a32d5a5
7
- data.tar.gz: 39a39ea629c33c7b72bdce8f61b8612629f7d381a43cc520009b485bd15f541263bdf4a33542a358446e7d8255da9ea0ad4de86123955df7174094fd0d54530a
6
+ metadata.gz: e12dbe849abc336a65894be858be518433b97b9b9ac2622581534b7da9078de2f10fe21270dfed58cee58bb7a0f2003f40f86d9d3e1dcf662cad952dd2e41e20
7
+ data.tar.gz: dd9b487f4a8a868e07c39837732433662879696f12378666d700a69ed561743e47dd5a0bd607b87e381b7abe63ffe6d36ebfba61a7efc848e95fedfd7cf4f0f8
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2022 Keith Morrison <keithm@infused.org>
1
+ Copyright (c) 2015-2023 Keith Morrison <keithm@infused.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Get time zone, daylight saving time, and base offset for any US ZIP code.
8
8
 
9
- <i>ZIP codes are up to date as of <b>October 2022</b>.</i>
9
+ <i>ZIP codes are up to date as of <b>July 2023</b>.</i>
10
10
 
11
11
  ## Compatibility
12
12
 
@@ -160,7 +160,7 @@ Time zone names now reflect standard tz-database names.
160
160
 
161
161
  ## License
162
162
 
163
- Copyright (c) 2015-2022 Keith Morrison <<keithm@infused.org>>
163
+ Copyright (c) 2015-2023 Keith Morrison <<keithm@infused.org>>
164
164
 
165
165
  Permission is hereby granted, free of charge, to any person
166
166
  obtaining a copy of this software and associated documentation
data/data/tz.data CHANGED
Binary file
data/lib/ziptz.rb CHANGED
@@ -2,7 +2,7 @@ require 'yaml'
2
2
  require 'zlib'
3
3
 
4
4
  class Ziptz
5
- VERSION = '3.0.12'.freeze
5
+ VERSION = '3.0.18'.freeze
6
6
 
7
7
  def self.instance
8
8
  @instance ||= new
@@ -44,12 +44,19 @@ class Ziptz
44
44
  @tzm ||= load_tzm_data
45
45
  end
46
46
 
47
+ def lazy_tz
48
+ @lazy_tz ||= lazy_load_tz_data
49
+ end
50
+
47
51
  def tz
48
52
  @tz ||= load_tz_data
49
53
  end
50
54
 
51
55
  def time_zone_info(zip)
52
- tz[zip.to_s.slice(0, 5)]
56
+ if (data = lazy_tz[zip.to_s.slice(0, 5)])
57
+ _, tz, dst = data.strip.split('|')
58
+ {tz: tz, dst: dst == '1'}
59
+ end
53
60
  end
54
61
 
55
62
  def tzm_data_path
@@ -60,6 +67,13 @@ class Ziptz
60
67
  File.join(File.dirname(__FILE__), '..', 'data', 'tz.data')
61
68
  end
62
69
 
70
+ def lazy_load_tz_data
71
+ uncompressed = Zlib::Inflate.inflate(File.read(tz_data_path, encoding: 'ASCII-8BIT'))
72
+ uncompressed.each_line.with_object({}) do |line, data|
73
+ data[line.slice(0, 5)] = line
74
+ end
75
+ end
76
+
63
77
  def load_tz_data
64
78
  uncompressed = Zlib::Inflate.inflate(File.read(tz_data_path, encoding: 'ASCII-8BIT'))
65
79
  uncompressed.each_line.with_object({}) do |line, data|
data/ziptz.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rdoc_options = ['--charset=UTF-8']
15
15
  s.extra_rdoc_files = ['README.md', 'LICENSE']
16
- s.files = Dir['[A-Z]*', '{data,lib,spec}/**/*', 'ziptz.gemspec']
17
- s.test_files = Dir.glob('spec/**/*_spec.rb')
16
+ s.files = Dir['README.md', 'LICENSE', '{data,lib,spec}/**/*', 'ziptz.gemspec']
18
17
  s.require_paths = ['lib']
19
18
  s.required_ruby_version = '>= 2.0.0'
19
+ s.metadata['rubygems_mfa_required'] = 'true'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ziptz
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.12
4
+ version: 3.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-06 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Get timezone info for all 5-digit US zip codes
14
14
  email: keithm@infused.org
@@ -18,15 +18,10 @@ extra_rdoc_files:
18
18
  - README.md
19
19
  - LICENSE
20
20
  files:
21
- - Gemfile
22
- - Gemfile.lock
23
- - Guardfile
24
21
  - LICENSE
25
22
  - README.md
26
- - Rakefile
27
23
  - data/tz.data
28
24
  - data/tzm.data
29
- - database.yml
30
25
  - lib/ziptz.rb
31
26
  - spec/spec_helper.rb
32
27
  - spec/ziptz_spec.rb
@@ -34,7 +29,8 @@ files:
34
29
  homepage: http://github.com/infused/ziptz
35
30
  licenses:
36
31
  - MIT
37
- metadata: {}
32
+ metadata:
33
+ rubygems_mfa_required: 'true'
38
34
  post_install_message:
39
35
  rdoc_options:
40
36
  - "--charset=UTF-8"
@@ -51,9 +47,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
47
  - !ruby/object:Gem::Version
52
48
  version: '0'
53
49
  requirements: []
54
- rubygems_version: 3.3.21
50
+ rubygems_version: 3.4.10
55
51
  signing_key:
56
52
  specification_version: 4
57
53
  summary: TimeZone info for any 5-digit US zip code
58
- test_files:
59
- - spec/ziptz_spec.rb
54
+ test_files: []
data/Gemfile DELETED
@@ -1,18 +0,0 @@
1
- gemspec
2
- source 'https://rubygems.org'
3
-
4
- group :development, :test do
5
- gem 'activerecord'
6
- gem 'bundler'
7
- gem 'byebug'
8
- gem 'guard'
9
- gem 'guard-rspec'
10
- gem 'irb'
11
- gem 'mysql2'
12
- gem 'rake'
13
- gem 'rspec'
14
- gem 'rubocop'
15
- gem 'rubocop-performance'
16
- gem 'rubocop-rspec'
17
- gem 'tty-spinner'
18
- end
data/Gemfile.lock DELETED
@@ -1,135 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ziptz (3.0.11)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- activemodel (6.1.3.1)
10
- activesupport (= 6.1.3.1)
11
- activerecord (6.1.3.1)
12
- activemodel (= 6.1.3.1)
13
- activesupport (= 6.1.3.1)
14
- activesupport (6.1.3.1)
15
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 1.6, < 2)
17
- minitest (>= 5.1)
18
- tzinfo (~> 2.0)
19
- zeitwerk (~> 2.3)
20
- ast (2.4.2)
21
- byebug (11.1.3)
22
- coderay (1.1.3)
23
- concurrent-ruby (1.1.8)
24
- diff-lcs (1.4.4)
25
- ffi (1.15.0)
26
- formatador (0.2.5)
27
- guard (2.16.2)
28
- formatador (>= 0.2.4)
29
- listen (>= 2.7, < 4.0)
30
- lumberjack (>= 1.0.12, < 2.0)
31
- nenv (~> 0.1)
32
- notiffany (~> 0.0)
33
- pry (>= 0.9.12)
34
- shellany (~> 0.0)
35
- thor (>= 0.18.1)
36
- guard-compat (1.2.1)
37
- guard-rspec (4.7.3)
38
- guard (~> 2.1)
39
- guard-compat (~> 1.1)
40
- rspec (>= 2.99.0, < 4.0)
41
- i18n (1.8.10)
42
- concurrent-ruby (~> 1.0)
43
- io-console (0.5.9)
44
- irb (1.3.5)
45
- reline (>= 0.1.5)
46
- listen (3.5.1)
47
- rb-fsevent (~> 0.10, >= 0.10.3)
48
- rb-inotify (~> 0.9, >= 0.9.10)
49
- lumberjack (1.2.8)
50
- method_source (1.0.0)
51
- minitest (5.14.4)
52
- mysql2 (0.5.3)
53
- nenv (0.3.0)
54
- notiffany (0.1.3)
55
- nenv (~> 0.1)
56
- shellany (~> 0.0)
57
- parallel (1.20.1)
58
- parser (3.0.1.0)
59
- ast (~> 2.4.1)
60
- pry (0.14.1)
61
- coderay (~> 1.1)
62
- method_source (~> 1.0)
63
- rainbow (3.0.0)
64
- rake (13.0.3)
65
- rb-fsevent (0.10.4)
66
- rb-inotify (0.10.1)
67
- ffi (~> 1.0)
68
- regexp_parser (2.1.1)
69
- reline (0.2.5)
70
- io-console (~> 0.5)
71
- rexml (3.2.5)
72
- rspec (3.10.0)
73
- rspec-core (~> 3.10.0)
74
- rspec-expectations (~> 3.10.0)
75
- rspec-mocks (~> 3.10.0)
76
- rspec-core (3.10.1)
77
- rspec-support (~> 3.10.0)
78
- rspec-expectations (3.10.1)
79
- diff-lcs (>= 1.2.0, < 2.0)
80
- rspec-support (~> 3.10.0)
81
- rspec-mocks (3.10.2)
82
- diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.10.0)
84
- rspec-support (3.10.2)
85
- rubocop (1.13.0)
86
- parallel (~> 1.10)
87
- parser (>= 3.0.0.0)
88
- rainbow (>= 2.2.2, < 4.0)
89
- regexp_parser (>= 1.8, < 3.0)
90
- rexml
91
- rubocop-ast (>= 1.2.0, < 2.0)
92
- ruby-progressbar (~> 1.7)
93
- unicode-display_width (>= 1.4.0, < 3.0)
94
- rubocop-ast (1.4.1)
95
- parser (>= 2.7.1.5)
96
- rubocop-performance (1.11.1)
97
- rubocop (>= 1.7.0, < 2.0)
98
- rubocop-ast (>= 0.4.0)
99
- rubocop-rspec (2.3.0)
100
- rubocop (~> 1.0)
101
- rubocop-ast (>= 1.1.0)
102
- ruby-progressbar (1.11.0)
103
- shellany (0.0.1)
104
- thor (1.1.0)
105
- tty-cursor (0.7.1)
106
- tty-spinner (0.9.3)
107
- tty-cursor (~> 0.7)
108
- tzinfo (2.0.4)
109
- concurrent-ruby (~> 1.0)
110
- unicode-display_width (2.0.0)
111
- zeitwerk (2.4.2)
112
-
113
- PLATFORMS
114
- arm64-darwin-21
115
- x86_64-darwin-19
116
- x86_64-darwin-21
117
-
118
- DEPENDENCIES
119
- activerecord
120
- bundler
121
- byebug
122
- guard
123
- guard-rspec
124
- irb
125
- mysql2
126
- rake
127
- rspec
128
- rubocop
129
- rubocop-performance
130
- rubocop-rspec
131
- tty-spinner
132
- ziptz!
133
-
134
- BUNDLED WITH
135
- 2.3.19
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec, cmd: 'bundle exec rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { 'spec' }
8
- end
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.setup(:default, :development)
3
-
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new :spec do |t|
6
- t.rspec_opts = %w[--color]
7
- end
8
-
9
- RSpec::Core::RakeTask.new :specdoc do |t|
10
- t.rspec_opts = %w[-fl]
11
- end
12
-
13
- task default: :spec
14
-
15
- desc 'Open an irb session preloaded with this library'
16
- task :console do
17
- sh 'irb -r rubygems -I lib -r ziptz.rb'
18
- end
data/database.yml DELETED
@@ -1,3 +0,0 @@
1
- adapter: mysql2
2
- username: root
3
- database: zip_codes