street_address_ext 0.0.3 → 0.0.5

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
  SHA1:
3
- metadata.gz: cc4d050df1823a1859fb52420939daae07c67ed0
4
- data.tar.gz: 60cd0b2706173442c69934d513a0dbceaa4f7d70
3
+ metadata.gz: 77c5a22892fc7e427b2b7aaf2eb2d7875ed7745a
4
+ data.tar.gz: 268e4b6188915a0745ff1a47f55125eadf311319
5
5
  SHA512:
6
- metadata.gz: 050bc03d773a8c267a345fba92a7ed18a3a5da966fe045651456d5f51851394a5c44d37ef49f2df3845b5836a059b58fe5f98662a4396395926680180ce3a455
7
- data.tar.gz: 622f1a9cdfba206d5fe04500f4991f455f58f1af8cd66532934045d11f03b27bfca31db9410d634bb224fe55d2209c962f46fa2cce0f1e932c7e427048253c28
6
+ metadata.gz: d4b8b654b32da407167f396deb0de0eaf24ebba73217045755413b353d217be3ce3553cf54af7c8e4bd1e277eddef55212466a4f352a677d40591e9549b42385
7
+ data.tar.gz: 155d53217a53fe99c72da7cba37996ae89c9e55314081f0e047aeb2f0bc5b788d522b7743446fee2e10d483bf4541f2dd431fff57eed6afeae4ef7f8f46d9afe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+
2
+ Current
3
+ -------
4
+
5
+ 0.0.5 (2016-12-7)
6
+ -----------------
7
+
8
+ Fix bug where "".trim was called instead of "".strip
9
+
10
+ 0.0.4 (2016-12-7)
11
+ -----------------
12
+
13
+ Upgrade to StreetAddres 1.0.6 (2.0 has not been released)
14
+
15
+ Remove trailing 'United States' or 'USA'
16
+
17
+
1
18
  0.0.3 (2014-02-24)
2
19
  ------------------
3
20
 
data/Guardfile CHANGED
@@ -2,6 +2,5 @@
2
2
  guard 'minitest' do
3
3
  watch(%r|^test/(.*)_test\.rb|)
4
4
  watch(%r|^lib/(.*?)([^/\\]+)\.rb|) { |m| "test/#{m[2]}_test.rb" }
5
- watch(%r|^street_address_ext.rb|) { |m| "test/street_address_ext_test.rb" }
6
5
  watch(%r|^test/helper\.rb|) { "test" }
7
6
  end
@@ -1,3 +1,3 @@
1
1
  module StreetAddressFilter
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -42,6 +42,7 @@ module StreetAddressExt
42
42
  extend self
43
43
 
44
44
  def parse text
45
+ text = strip_country text.strip
45
46
  address = StreetAddress::US.parse(text)
46
47
  unless address
47
48
  address = StreetAddress::US.parse("#{text},UT")
@@ -50,6 +51,10 @@ module StreetAddressExt
50
51
  normalize address if address
51
52
  end
52
53
 
54
+ def strip_country text
55
+ return text.sub(/(?:(?:United States)|USA)$/, '')
56
+ end
57
+
53
58
  def normalize address
54
59
  return nil unless address
55
60
  address = address.dup
@@ -27,6 +27,11 @@ describe StreetAddressExt do
27
27
  parse(text).to_s.must_equal text
28
28
  end
29
29
 
30
+ it 'removes United States' do
31
+ text = '3120 WEST 1200 NORTH, WEST POINT, Utah 84015 United States '
32
+ parse(text).to_s.must_equal "3120 W 1200 N, West Point"
33
+ end
34
+
30
35
  #it 'handles aka first address is valid' do
31
36
  #skip
32
37
  #text = '2286 West 1445 North aka 1459 North 2275 West, Clinton, UT'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: street_address_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-24 00:00:00.000000000 Z
11
+ date: 2016-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: StreetAddress
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.2.0
151
+ rubygems_version: 2.5.1
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Extend StreetAddress