StreetAddress 1.0.5 → 2.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b39341a1cc71e0b60638cb25159114b89c2bfc73fd86311663a346e729a96e13
4
+ data.tar.gz: 1c0a33da1d9fb744cef41f7e8f439d01681f1fb3500e14eaf695efdfa1740e39
5
+ SHA512:
6
+ metadata.gz: e7888fa1e2419e5e0e67177f9099c4e68d8e45ab6d45c710066803b7d092035ac78d8c2e78116555d735d370eacad6af4c09e9906a309639962cef9bdc3260f2
7
+ data.tar.gz: '056349ebed8575a764dac7a8130dd6150a5385d8b9e6949bbf8c6882d06fe0bb480f7a31861bdb512811453d5273f14ab87745c5d129c96384b2a064581f542b'
data/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ ## [2.0.0] - 2026-03-23
8
+
9
+ ### Added
10
+ - `line1` and `line2` methods for USPS-formatted address lines
11
+ - `to_s` with format argument (`:line1`, `:line2`, `:default`)
12
+ - `to_h` method to convert address to a hash
13
+ - `full_postal_code` method (returns "12345" or "12345-6789")
14
+ - `==` comparison operator for Address objects
15
+ - `state_fips` and `state_name` methods
16
+ - `avoid_redundant_street_type` option for `parse`
17
+ - ZIP+4 support (with or without hyphen)
18
+ - Informal address parsing (partial addresses without city/state)
19
+ - City directional expansion ("e San Jose" → "East San Jose")
20
+ - Word capitalization normalization for street, city, unit_prefix
21
+ - GitHub Actions CI (Ruby 3.3 and 3.4)
22
+ - CHANGELOG.md
23
+
24
+ ### Changed
25
+ - Minimum Ruby version is now 3.3 (dropped support for Ruby < 3.3)
26
+ - Named capture groups in regexes replace positional match indices
27
+ - `\A`/`\z` anchors replace `^`/`$` for correctness with multiline strings
28
+ - Modernized gemspec (removed shell commands, added metadata)
29
+ - Replaced CircleCI with GitHub Actions
30
+
31
+ ### Removed
32
+ - CircleCI configuration (replaced by GitHub Actions)
33
+ - Inline rdoc blocks (moved to README)
34
+
35
+ ### Fixed
36
+ - `MiniTest::Test` → `Minitest::Test` for modern Minitest compatibility
37
+ - Duplicate `unit_regexp` declaration in `attr_accessor` block
38
+ - `assert_equal nil` → `assert_nil` in tests for modern Minitest
39
+
40
+ ## [1.0.6] - 2014-12-21
41
+
42
+ ### Fixed
43
+ - Various bug fixes and improvements
44
+
45
+ ## [1.0.0] - 2011-08-05
46
+
47
+ - Initial release as a Ruby gem
48
+ - Port of Perl module Geo::StreetAddress::US
data/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2007-2026 Derrek Long and Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,103 @@
1
+ [![Gem Version](https://img.shields.io/gem/v/StreetAddress.svg)](https://rubygems.org/gems/StreetAddress)
2
+ [![CI](https://github.com/street-address-rb/street-address/actions/workflows/ci.yml/badge.svg)](https://github.com/street-address-rb/street-address/actions/workflows/ci.yml)
3
+
4
+ # StreetAddress
5
+
6
+ Parses a US street address string and returns a normalized Address object. Returns `nil` when the string is not a recognized US address format.
7
+
8
+ This is a port of the Perl module [Geo::StreetAddress::US](https://github.com/timbunce/Geo-StreetAddress-US) originally written by Schuyler D. Erle.
9
+
10
+ ## Ruby Version
11
+
12
+ Requires Ruby 3.3 or later. For Ruby 2.x support, use gem version 1.0.6.
13
+
14
+ ## Installation
15
+
16
+ ```shell
17
+ gem install StreetAddress
18
+ ```
19
+
20
+ then in your code
21
+
22
+ ```ruby
23
+ require 'street_address'
24
+ ```
25
+
26
+ or in your Gemfile
27
+
28
+ ```ruby
29
+ gem 'StreetAddress', require: 'street_address'
30
+ ```
31
+
32
+ ## Basic Usage
33
+
34
+ ```ruby
35
+ require 'street_address'
36
+
37
+ address = StreetAddress::US.parse("1600 Pennsylvania Ave, Washington, DC, 20500")
38
+ address.number # "1600"
39
+ address.street # "Pennsylvania"
40
+ address.street_type # "Ave"
41
+ address.city # "Washington"
42
+ address.state # "DC"
43
+ address.state_name # "District Of Columbia"
44
+ address.postal_code # "20500"
45
+ address.intersection? # false
46
+ address.to_s # "1600 Pennsylvania Ave, Washington, DC 20500"
47
+ address.to_s(:line1) # "1600 Pennsylvania Ave"
48
+ address.to_s(:line2) # "Washington, DC 20500"
49
+ address.to_h # { number: "1600", street: "Pennsylvania", ... }
50
+
51
+ address = StreetAddress::US.parse("1600 Pennsylvania Ave")
52
+ address.street # "Pennsylvania"
53
+ address.number # "1600"
54
+ address.state # nil
55
+ ```
56
+
57
+ ## ZIP+4 Support
58
+
59
+ ```ruby
60
+ address = StreetAddress::US.parse("5904 Richmond Hwy Ste 340 Alexandria VA 22303-1864")
61
+ address.postal_code # "22303"
62
+ address.postal_code_ext # "1864"
63
+ address.full_postal_code # "22303-1864"
64
+
65
+ # Also works without the hyphen
66
+ address = StreetAddress::US.parse("5904 Richmond Hwy Ste 340 Alexandria VA 223031864")
67
+ address.postal_code_ext # "1864"
68
+ ```
69
+
70
+ ## Intersection Parsing
71
+
72
+ ```ruby
73
+ address = StreetAddress::US.parse("Hollywood Blvd and Vine St, Los Angeles, CA")
74
+ address.intersection? # true
75
+ address.street # "Hollywood"
76
+ address.street_type # "Blvd"
77
+ address.street2 # "Vine"
78
+ address.street_type2 # "St"
79
+ ```
80
+
81
+ ## Stricter Parsing
82
+
83
+ ```ruby
84
+ address = StreetAddress::US.parse_address("1600 Pennsylvania Avenue")
85
+ # nil - not enough information to be a full address
86
+
87
+ address = StreetAddress::US.parse_address("1600 Pennsylvania Ave, Washington, DC, 20500")
88
+ # Returns Address object - full address provided
89
+ ```
90
+
91
+ ## Known Limitations
92
+
93
+ - US addresses only (returns `nil` for international addresses)
94
+ - PO Boxes are not supported
95
+ - Military addresses (APO/FPO) are not supported
96
+ - Rural routes (RR) and highway contract routes (HC) are not supported
97
+ - Addresses ending in "United States" or "USA" may not parse correctly
98
+
99
+ ## License
100
+
101
+ The [MIT License](http://opensource.org/licenses/MIT)
102
+
103
+ Copyright (c) 2007-2026 Derrek Long and Contributors