dc_address_parser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14263a461a3fe0f8d380d0e2694fdf0025332b8e
4
- data.tar.gz: 01cca92f544be21c6315868c304b9af79dd6aed4
3
+ metadata.gz: 07f0c5a7d4ac58c6defcc2e5e4f9053fe486137c
4
+ data.tar.gz: 7421f846de941ad02a85fb5f1c42990b41da3484
5
5
  SHA512:
6
- metadata.gz: 6b7158a7cb1d8e8e98698977a80bf7bcb8477c702bc0d708f51e7751e50ea711d1cabf1f1cc03b84ea3d8e577e86c9fcfd6aa34eb01ccc9d18dd9f9ed534fd3b
7
- data.tar.gz: ce7e8cb159ceaa92d687a8db3e6f4c7216e1a7c42ae1831598d40a25a20f7a4329debf28e256e355a692d31e8cc87664aa7a80f6a923eecec7199b1d6ac117bb
6
+ metadata.gz: 918a182fa39f6bf528f582531745a9871fc48587fcedb331e7b674d837a27e2a6b36a6dc20a6d4cc5d91d4b6daff927df99dbd93e50c7e69c8f4724cb113d0d5
7
+ data.tar.gz: 5b2fcd0689f395b98a0c1fb42d4859f97d89425ae47586334ee1ac7abe1c0e42a46175042742b30a19a490b1e6f44b2ca2c98bd2c98cb96bd789a91c2f1128b4
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -1,4 +1,6 @@
1
1
  require "dc_address_parser/version"
2
+ require "dc_address_parser/constants"
3
+
2
4
  require "dc_address_parser/address"
3
5
  require "active_support/inflector"
4
6
  require "dc_address_lookup"
@@ -4,33 +4,11 @@ module DcAddressParser
4
4
 
5
5
  attr_reader :raw_address
6
6
 
7
- CITY = "WASHINGTON, DC"
8
- STREET_TYPES = {
9
- "STREET" => "ST",
10
- "AVENUE" => "AVE",
11
- "BOULEVARD" => "BLVD",
12
- "ROAD" => "RD",
13
- "PLACE" => "PL",
14
- "DRIVE" => "DR",
15
- "CIRCLE" => "CIR",
16
- "PALZA" => "PLZ",
17
- "COURT" => "CT",
18
- "ALLEY" => "AL",
19
- "TERRACE" => "TER"
20
- }
21
-
22
- DIRECTIONS = {
23
- "NORTH" => "N",
24
- "SOUTH" => "S",
25
- "EAST" => "E",
26
- "WEST" => "W"
27
- }
28
-
29
7
  NUMBER_REGEX = /\A(\d+)[A-Z]*/
30
8
  NUMBER_SUFFIX_REGEX = /(\d+\/\d+|rear)/i
31
9
  STREET_NAME_REGEX = /([A-Z0-9' ]+)/
32
- STREET_TYPE_REGEX = /\b(#{Regexp.union(STREET_TYPES.keys)})\b/
33
- STREET_TYPE_ABV_REGEX = /\b(#{Regexp.union(STREET_TYPES.values)})\b/
10
+ STREET_TYPE_REGEX = /\b(#{Regexp.union(DcAddressParser::STREET_TYPES.keys)})\b/
11
+ STREET_TYPE_ABV_REGEX = /\b(#{Regexp.union(DcAddressParser::STREET_TYPES.values)})\b/
34
12
  QUADRANT_REGEX = /([NS][EW])/
35
13
 
36
14
  REQUIRED_PARTS = [:number, :street_name, :street_type, :quadrant]
@@ -98,7 +76,7 @@ module DcAddressParser
98
76
  street_type: street_type,
99
77
  quadrant: quadrant,
100
78
  unit_number: unit_number,
101
- city: CITY
79
+ city: DcAddressParser::CITY
102
80
  }
103
81
  end
104
82
 
@@ -151,7 +129,7 @@ module DcAddressParser
151
129
  end
152
130
 
153
131
  def normalize_street_type
154
- @address.gsub!(STREET_TYPE_ABV_REGEX, STREET_TYPES.invert)
132
+ @address.gsub!(STREET_TYPE_ABV_REGEX, DcAddressParser::STREET_TYPES.invert)
155
133
  end
156
134
 
157
135
  def normalize_rear
@@ -171,8 +149,8 @@ module DcAddressParser
171
149
  end
172
150
 
173
151
  def normalize_directions
174
- regex = /\b(#{Regexp.union DIRECTIONS.values})(?=\s+|\.)/
175
- @address.gsub!(regex, DIRECTIONS.invert)
152
+ regex = /\b(#{Regexp.union DcAddressParser::DIRECTIONS.values})(?=\s+|\.)/
153
+ @address.gsub!(regex, DcAddressParser::DIRECTIONS.invert)
176
154
  end
177
155
 
178
156
  def normalize_mt
@@ -0,0 +1,24 @@
1
+ module DcAddressParser
2
+ CITY = "WASHINGTON, DC"
3
+
4
+ STREET_TYPES = {
5
+ "STREET" => "ST",
6
+ "AVENUE" => "AVE",
7
+ "BOULEVARD" => "BLVD",
8
+ "ROAD" => "RD",
9
+ "PLACE" => "PL",
10
+ "DRIVE" => "DR",
11
+ "CIRCLE" => "CIR",
12
+ "PALZA" => "PLZ",
13
+ "COURT" => "CT",
14
+ "ALLEY" => "AL",
15
+ "TERRACE" => "TER"
16
+ }
17
+
18
+ DIRECTIONS = {
19
+ "NORTH" => "N",
20
+ "SOUTH" => "S",
21
+ "EAST" => "E",
22
+ "WEST" => "W"
23
+ }
24
+ end
@@ -1,3 +1,3 @@
1
1
  module DcAddressParser
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/script/cibuild CHANGED
@@ -1,3 +1,6 @@
1
1
  #!/bin/sh
2
2
 
3
+ set -ex
4
+
3
5
  bundle exec rake spec
6
+ gem build dc_address_parser.gemspec
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dc_address_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
@@ -126,6 +126,7 @@ files:
126
126
  - dc_address_parser.gemspec
127
127
  - lib/dc_address_parser.rb
128
128
  - lib/dc_address_parser/address.rb
129
+ - lib/dc_address_parser/constants.rb
129
130
  - lib/dc_address_parser/version.rb
130
131
  - script/bootstrap
131
132
  - script/cibuild