zip-codes 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +146 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +32 -4
- data/README.md +4 -0
- data/Rakefile +6 -6
- data/lib/data/US.yml +1263 -172
- data/lib/zip-codes.rb +6 -5
- data/zip-codes.gemspec +17 -14
- metadata +27 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9cd29c93f5a9c7b5812474a514d36bd04f2167f76fb1e5e93802a944c281d5f2
|
4
|
+
data.tar.gz: 392c21b547ba63c9b972fc36330cc17126bc9b5503c64c54b6ec0a207a3648fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2dcc4dfe3c3a52ec10b257696ca5445c920ee01bd81752040e84647bbf5a7e4f550f801263e7f6e7ff0c0703a865b9717742c6cb4cc350f1cc433eb07a1deb2
|
7
|
+
data.tar.gz: 9e9fdf33fcb283371986183b54b91b0a1ba7492f4fdf6a31232258f2c8ff221638df7c12d89d88483e0fee99bfb6bf432026e18c9ba055d01a26f2fb9c3edaf1
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rake
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
TargetRubyVersion: 3.0
|
6
|
+
|
7
|
+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
8
|
+
Enabled: true
|
9
|
+
Gemspec/RequireMFA: # new in 1.23
|
10
|
+
Enabled: true
|
11
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
12
|
+
Enabled: true
|
13
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
14
|
+
Enabled: true
|
15
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
16
|
+
Enabled: true
|
17
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
18
|
+
Enabled: true
|
19
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
20
|
+
Enabled: true
|
21
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
22
|
+
Enabled: true
|
23
|
+
Lint/AmbiguousRange: # new in 1.19
|
24
|
+
Enabled: true
|
25
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
26
|
+
Enabled: true
|
27
|
+
Lint/DeprecatedConstants: # new in 1.8
|
28
|
+
Enabled: true
|
29
|
+
Lint/DuplicateBranch: # new in 1.3
|
30
|
+
Enabled: true
|
31
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
32
|
+
Enabled: true
|
33
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
34
|
+
Enabled: true
|
35
|
+
Lint/EmptyBlock: # new in 1.1
|
36
|
+
Enabled: true
|
37
|
+
Lint/EmptyClass: # new in 1.3
|
38
|
+
Enabled: true
|
39
|
+
Lint/EmptyInPattern: # new in 1.16
|
40
|
+
Enabled: true
|
41
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
42
|
+
Enabled: true
|
43
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
44
|
+
Enabled: true
|
45
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
46
|
+
Enabled: true
|
47
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
48
|
+
Enabled: true
|
49
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
50
|
+
Enabled: true
|
51
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
52
|
+
Enabled: true
|
53
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
54
|
+
Enabled: true
|
55
|
+
Lint/RefinementImportMethods: # new in 1.27
|
56
|
+
Enabled: true
|
57
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
58
|
+
Enabled: true
|
59
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
60
|
+
Enabled: true
|
61
|
+
Lint/SymbolConversion: # new in 1.9
|
62
|
+
Enabled: true
|
63
|
+
Lint/ToEnumArguments: # new in 1.1
|
64
|
+
Enabled: true
|
65
|
+
Lint/TripleQuotes: # new in 1.9
|
66
|
+
Enabled: true
|
67
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
68
|
+
Enabled: true
|
69
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
70
|
+
Enabled: true
|
71
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
72
|
+
Enabled: true
|
73
|
+
Naming/BlockForwarding: # new in 1.24
|
74
|
+
Enabled: true
|
75
|
+
Security/CompoundHash: # new in 1.28
|
76
|
+
Enabled: true
|
77
|
+
Security/IoMethods: # new in 1.22
|
78
|
+
Enabled: true
|
79
|
+
Style/ArgumentsForwarding: # new in 1.1
|
80
|
+
Enabled: true
|
81
|
+
Style/CollectionCompact: # new in 1.2
|
82
|
+
Enabled: true
|
83
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
84
|
+
Enabled: true
|
85
|
+
Style/EmptyHeredoc: # new in 1.32
|
86
|
+
Enabled: true
|
87
|
+
Style/EndlessMethod: # new in 1.8
|
88
|
+
Enabled: true
|
89
|
+
Style/EnvHome: # new in 1.29
|
90
|
+
Enabled: true
|
91
|
+
Style/FetchEnvVar: # new in 1.28
|
92
|
+
Enabled: true
|
93
|
+
Style/FileRead: # new in 1.24
|
94
|
+
Enabled: true
|
95
|
+
Style/FileWrite: # new in 1.24
|
96
|
+
Enabled: true
|
97
|
+
Style/HashConversion: # new in 1.10
|
98
|
+
Enabled: true
|
99
|
+
Style/HashExcept: # new in 1.7
|
100
|
+
Enabled: true
|
101
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
102
|
+
Enabled: true
|
103
|
+
Style/InPatternThen: # new in 1.16
|
104
|
+
Enabled: true
|
105
|
+
Style/MagicCommentFormat: # new in 1.35
|
106
|
+
Enabled: true
|
107
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
108
|
+
Enabled: true
|
109
|
+
Style/MapToHash: # new in 1.24
|
110
|
+
Enabled: true
|
111
|
+
Style/MultilineInPatternThen: # new in 1.16
|
112
|
+
Enabled: true
|
113
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
114
|
+
Enabled: true
|
115
|
+
Style/NestedFileDirname: # new in 1.26
|
116
|
+
Enabled: true
|
117
|
+
Style/NilLambda: # new in 1.3
|
118
|
+
Enabled: true
|
119
|
+
Style/NumberedParameters: # new in 1.22
|
120
|
+
Enabled: true
|
121
|
+
Style/NumberedParametersLimit: # new in 1.22
|
122
|
+
Enabled: true
|
123
|
+
Style/ObjectThen: # new in 1.28
|
124
|
+
Enabled: true
|
125
|
+
Style/OpenStructUse: # new in 1.23
|
126
|
+
Enabled: true
|
127
|
+
Style/OperatorMethodCall: # new in 1.37
|
128
|
+
Enabled: true
|
129
|
+
Style/QuotedSymbols: # new in 1.16
|
130
|
+
Enabled: true
|
131
|
+
Style/RedundantArgument: # new in 1.4
|
132
|
+
Enabled: true
|
133
|
+
Style/RedundantEach: # new in 1.38
|
134
|
+
Enabled: true
|
135
|
+
Style/RedundantInitialize: # new in 1.27
|
136
|
+
Enabled: true
|
137
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
138
|
+
Enabled: true
|
139
|
+
Style/RedundantStringEscape: # new in 1.37
|
140
|
+
Enabled: true
|
141
|
+
Style/SelectByRegexp: # new in 1.22
|
142
|
+
Enabled: true
|
143
|
+
Style/StringChars: # new in 1.12
|
144
|
+
Enabled: true
|
145
|
+
Style/SwapValues: # new in 1.1
|
146
|
+
Enabled: true
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zip-codes (0.1
|
4
|
+
zip-codes (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
9
|
+
ast (2.4.2)
|
10
|
+
json (2.6.2)
|
11
|
+
parallel (1.22.1)
|
12
|
+
parser (3.1.3.0)
|
13
|
+
ast (~> 2.4.1)
|
14
|
+
rainbow (3.1.1)
|
15
|
+
rake (13.0.6)
|
16
|
+
regexp_parser (2.6.1)
|
17
|
+
rexml (3.2.5)
|
18
|
+
rubocop (1.39.0)
|
19
|
+
json (~> 2.3)
|
20
|
+
parallel (~> 1.10)
|
21
|
+
parser (>= 3.1.2.1)
|
22
|
+
rainbow (>= 2.2.2, < 4.0)
|
23
|
+
regexp_parser (>= 1.8, < 3.0)
|
24
|
+
rexml (>= 3.2.5, < 4.0)
|
25
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
26
|
+
ruby-progressbar (~> 1.7)
|
27
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
28
|
+
rubocop-ast (1.24.0)
|
29
|
+
parser (>= 3.1.1.0)
|
30
|
+
rubocop-rake (0.6.0)
|
31
|
+
rubocop (~> 1.0)
|
32
|
+
ruby-progressbar (1.11.0)
|
33
|
+
unicode-display_width (2.3.0)
|
10
34
|
|
11
35
|
PLATFORMS
|
12
36
|
ruby
|
13
37
|
|
14
38
|
DEPENDENCIES
|
15
|
-
|
16
|
-
|
39
|
+
rake (~> 13.0.0)
|
40
|
+
rubocop (~> 1.39.0)
|
41
|
+
rubocop-rake (~> 0.6.0)
|
17
42
|
zip-codes!
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
2.3.26
|
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Simple gem to get city, state, and time zone for a given zip code. It has a yaml database bundled with it, so you need several mb of memory for the whole hash.
|
4
4
|
|
5
|
+
The gem currently supports only US zip codes. The data origin is https://download.geonames.org/export/zip/
|
6
|
+
|
7
|
+
The main maintainer is https://github.com/brodyhoskins
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
2
4
|
require 'yaml'
|
3
5
|
|
4
6
|
task :convert do
|
5
7
|
codes = {}
|
6
8
|
File.open('lib/data/US.txt').each_line do |line|
|
7
|
-
array = line.split(
|
9
|
+
array = line.split('\t')
|
8
10
|
codes[array[1]] = {
|
9
11
|
state_code: array[4],
|
10
12
|
state_name: array[3],
|
11
|
-
city:
|
13
|
+
city: array[2]
|
12
14
|
}
|
13
15
|
end
|
14
16
|
|
15
|
-
File.
|
16
|
-
file.write codes.to_yaml
|
17
|
-
end
|
17
|
+
File.write('lib/data/US.yml', codes.to_yaml)
|
18
18
|
end
|