address_line_divider 1.0.3 → 1.0.4
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 +4 -4
- data/.github/workflows/cd.yml +31 -0
- data/.github/workflows/main.yml +3 -3
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/address_line_divider/address_parser.rb +15 -2
- data/lib/address_line_divider/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6ef2ffffc4e459d9c4ebf283cb7eafaf2c725ceff1da8ae3f06fcfbc77b8f45
|
4
|
+
data.tar.gz: f72ee12e5fdb98453d3653175fba57567d48da21e6917b125d60e04d93e76497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93f7cec2d436c1eb97459451d5b7a38505355d7b730d1886b4db37bdce2bf4ecfad02a29ed90cfd8478a5ee5d572aa516ca91d54142c48a43465507ac249325a
|
7
|
+
data.tar.gz: 19459ff082a0d8ad3c33369c4d4b0a2fa351a6e8cc941973258bf0ed5f637def7b9b88f238804d37c7d60b5cab57174f513e05a231b3356e1cc991280de62107
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: CD
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [closed]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
log:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- name: Log
|
12
|
+
run: |
|
13
|
+
echo "GITHUB_REF: $GITHUB_REF"
|
14
|
+
echo "github.head_ref: ${{ github.head_ref }}"
|
15
|
+
echo "github.base_ref: ${{ github.base_ref }}"
|
16
|
+
echo "contains(github.head_ref, 'release/v'): ${{ contains(github.head_ref, 'release/v') }}"
|
17
|
+
echo "github.base_ref == 'master': ${{ github.base_ref == 'master' }}"
|
18
|
+
echo "github.event.pull_request.merged: ${{ github.event.pull_request.merged }}"
|
19
|
+
cd:
|
20
|
+
runs-on: ubuntu-latest
|
21
|
+
if: ${{ contains(github.head_ref, 'release/v') && github.base_ref == 'master' && github.event.pull_request.merged == true }}
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
|
25
|
+
- name: Release Gem
|
26
|
+
uses: cadwallion/publish-rubygems-action@master
|
27
|
+
env:
|
28
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
29
|
+
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
30
|
+
RELEASE_COMMAND: bundle exec rake release
|
31
|
+
|
data/.github/workflows/main.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Changelog
|
2
|
-
|
3
|
-
|
2
|
+
## v1.0.4
|
3
|
+
* Improve Regex
|
4
|
+
## v1.0.3
|
4
5
|
* Small fixes
|
5
6
|
* CI Status badge
|
6
|
-
##
|
7
|
+
## v1.0.2
|
7
8
|
* Add MIT LICENSE
|
8
|
-
##
|
9
|
+
## v1.0.0
|
9
10
|
### Initial version
|
10
11
|
#### Features
|
11
12
|
* Parse address lines using a Regex
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
[](https://github.com/matiasalbarello/address_line_divider/actions/workflows/main.yml)
|
2
|
+
[](https://codeclimate.com/github/codeclimate/codeclimate/maintainability)
|
3
|
+
[](https://codeclimate.com/github/codeclimate/codeclimate/test_coverage)
|
2
4
|
# AddressLineDivider
|
3
5
|
|
4
6
|
The purpose of this GEM is to provide a tool to correctly parse address lines into Street + Street Number. Sometimes it's trivial and it can be solved with a regular expression, but when the street itself contains numbers, the task needs some extra considerations.
|
@@ -16,8 +16,21 @@ module AddressLineDivider
|
|
16
16
|
private
|
17
17
|
|
18
18
|
def parse_using_regex(address_line)
|
19
|
-
|
20
|
-
[
|
19
|
+
last_number_index = address_line.index(last_number(address_line))
|
20
|
+
street_name = address_line[0..last_number_index - 1].strip
|
21
|
+
street_no = address_line[last_number_index..-1].strip
|
22
|
+
|
23
|
+
[street_name, street_no]
|
24
|
+
end
|
25
|
+
|
26
|
+
def last_number(address_line)
|
27
|
+
squish(address_line).split(" ").select do |substr|
|
28
|
+
substr =~ /[[:digit:]]/
|
29
|
+
end.last
|
30
|
+
end
|
31
|
+
|
32
|
+
def squish(string)
|
33
|
+
string.gsub(" ", " ").strip
|
21
34
|
end
|
22
35
|
|
23
36
|
def search_street_on_file(address_line)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: address_line_divider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Albarello
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,6 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".github/workflows/cd.yml"
|
20
21
|
- ".github/workflows/main.yml"
|
21
22
|
- ".gitignore"
|
22
23
|
- ".rspec"
|