lite-address 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c29871c0adebc108e69481fd2029bbcb3d9176670e7b1d82d0cff2f83dc74a6e
4
+ data.tar.gz: 3a93c78446f6d75d78a9a8ba7e1af9137dd569704ed5abf88606a21f1b60c87b
5
+ SHA512:
6
+ metadata.gz: 800cb307c14b5f64acffa705694ada48b2e6f7d9224a4d20c8db6486da02a7e20ce65225df6095d566adefec953143e9ffaa5be28a10cea5e3e854de0e4cb1d1
7
+ data.tar.gz: 34c1856153094313069ab2b687dc867d8570330416fc1c3569febdc87d1f015ea94a09019bcea7083752ce561c91d5eb926f982633d885ab81b8e945242a8291
data/.fasterer.yml ADDED
@@ -0,0 +1,19 @@
1
+ speedups:
2
+ block_vs_symbol_to_proc: true
3
+ each_with_index_vs_while: false
4
+ fetch_with_argument_vs_block: true
5
+ for_loop_vs_each: true
6
+ getter_vs_attr_reader: true
7
+ gsub_vs_tr: true
8
+ hash_merge_bang_vs_hash_brackets: true
9
+ keys_each_vs_each_key: true
10
+ map_flatten_vs_flat_map: true
11
+ module_eval: true
12
+ proc_call_vs_yield: true
13
+ rescue_vs_respond_to: true
14
+ reverse_each_vs_reverse_each: true
15
+ select_first_vs_detect: true
16
+ select_last_vs_reverse_detect: true
17
+ setter_vs_attr_writer: true
18
+ shuffle_first_vs_sample: true
19
+ sort_vs_sort_by: true
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --backtrace
2
+ --color
3
+ --format progress
4
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,48 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+ AllCops:
6
+ TargetRubyVersion: 3.0
7
+ NewCops: enable
8
+ DisplayCopNames: true
9
+ DisplayStyleGuide: true
10
+ Gemspec/RequiredRubyVersion:
11
+ Enabled: false
12
+ Layout/EmptyLinesAroundAttributeAccessor:
13
+ Enabled: true
14
+ Layout/EmptyLinesAroundBlockBody:
15
+ Exclude:
16
+ - 'spec/**/**/*'
17
+ Layout/EmptyLinesAroundClassBody:
18
+ EnforcedStyle: empty_lines_except_namespace
19
+ Layout/EmptyLinesAroundModuleBody:
20
+ EnforcedStyle: empty_lines_except_namespace
21
+ Layout/LineLength:
22
+ Max: 100
23
+ Layout/SpaceAroundMethodCallOperator:
24
+ Enabled: true
25
+ Lint/RaiseException:
26
+ Enabled: true
27
+ Lint/StructNewOverride:
28
+ Enabled: true
29
+ Metrics/BlockLength:
30
+ Exclude:
31
+ - 'spec/**/**/*'
32
+ - '*.gemspec'
33
+ Metrics/ClassLength:
34
+ Enabled: false
35
+ Metrics/MethodLength:
36
+ Enabled: false
37
+ RSpec/ExampleLength:
38
+ Enabled: false
39
+ RSpec/MultipleExpectations:
40
+ Enabled: false
41
+ Style/ArgumentsForwarding:
42
+ Enabled: false
43
+ Style/Documentation:
44
+ Enabled: false
45
+ Style/ExpandPathArguments:
46
+ Enabled: false
47
+ Style/StructInheritance:
48
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.0] - 2021-09-09
10
+ ### Added
11
+ - Initial project version
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at j.gomez@drexed.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in lite-address.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lite-address (1.0.0)
5
+ countries
6
+ snail
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (6.1.4.1)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
17
+ ast (2.4.2)
18
+ colorize (0.8.1)
19
+ concurrent-ruby (1.1.9)
20
+ countries (4.0.1)
21
+ i18n_data (~> 0.13.0)
22
+ sixarm_ruby_unaccent (~> 1.1)
23
+ diff-lcs (1.4.4)
24
+ fasterer (0.9.0)
25
+ colorize (~> 0.7)
26
+ ruby_parser (>= 3.14.1)
27
+ i18n (1.8.10)
28
+ concurrent-ruby (~> 1.0)
29
+ i18n_data (0.13.0)
30
+ minitest (5.14.4)
31
+ parallel (1.20.2)
32
+ parser (3.0.2.0)
33
+ ast (~> 2.4.1)
34
+ rainbow (3.0.0)
35
+ rake (13.0.6)
36
+ regexp_parser (2.1.1)
37
+ rexml (3.2.5)
38
+ rspec (3.10.0)
39
+ rspec-core (~> 3.10.0)
40
+ rspec-expectations (~> 3.10.0)
41
+ rspec-mocks (~> 3.10.0)
42
+ rspec-core (3.10.1)
43
+ rspec-support (~> 3.10.0)
44
+ rspec-expectations (3.10.1)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.10.0)
47
+ rspec-mocks (3.10.2)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.10.0)
50
+ rspec-support (3.10.2)
51
+ rubocop (1.20.0)
52
+ parallel (~> 1.10)
53
+ parser (>= 3.0.0.0)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ regexp_parser (>= 1.8, < 3.0)
56
+ rexml
57
+ rubocop-ast (>= 1.9.1, < 2.0)
58
+ ruby-progressbar (~> 1.7)
59
+ unicode-display_width (>= 1.4.0, < 3.0)
60
+ rubocop-ast (1.11.0)
61
+ parser (>= 3.0.1.1)
62
+ rubocop-performance (1.11.5)
63
+ rubocop (>= 1.7.0, < 2.0)
64
+ rubocop-ast (>= 0.4.0)
65
+ rubocop-rake (0.6.0)
66
+ rubocop (~> 1.0)
67
+ rubocop-rspec (2.4.0)
68
+ rubocop (~> 1.0)
69
+ rubocop-ast (>= 1.1.0)
70
+ ruby-progressbar (1.11.0)
71
+ ruby_parser (3.17.0)
72
+ sexp_processor (~> 4.15, >= 4.15.1)
73
+ sexp_processor (4.15.3)
74
+ sixarm_ruby_unaccent (1.2.0)
75
+ snail (2.2.3)
76
+ activesupport
77
+ tzinfo (2.0.4)
78
+ concurrent-ruby (~> 1.0)
79
+ unicode-display_width (2.0.0)
80
+ zeitwerk (2.4.2)
81
+
82
+ PLATFORMS
83
+ x86_64-darwin-20
84
+
85
+ DEPENDENCIES
86
+ bundler
87
+ fasterer
88
+ lite-address!
89
+ rake
90
+ rspec
91
+ rubocop
92
+ rubocop-performance
93
+ rubocop-rake
94
+ rubocop-rspec
95
+
96
+ BUNDLED WITH
97
+ 2.2.26
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Juan Gomez
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # Lite::Address
2
+
3
+ Lite::Address is an address parser and formatter.
4
+ Currently supports US based addresses only.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'lite-address'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install lite-address
21
+
22
+ ## Table of Contents
23
+
24
+ * [Usage](#usage)
25
+ * [Formatting](#formatting)
26
+
27
+ ## Usage
28
+
29
+ Parsing an address will return a `Lite::Address::Format` object which responds to the
30
+ methods below (check the class to see more). If an address cannot be parsed then nil
31
+ will be returned, but partial matches can be returned. All addresses will try to be
32
+ normalized to return a predictable pattern.
33
+
34
+ ```
35
+ address = Lite::Address::Parse.parse("1600 Pennsylvania Ave, Washington, DC, 20500")
36
+ address.street #=> Pennsylvania
37
+ address.number #=> 1600
38
+ address.postal_code #=> 20500
39
+ address.city #=> Washington
40
+ address.state #=> DC
41
+ address.state_name #=> District of Columbia
42
+ address.street_type #=> Ave
43
+ address.intersection? #=> false
44
+
45
+ address = Lite::Address::Parse.parse("1600 Pennsylvania Ave")
46
+ address.street #=> Pennsylvania
47
+ address.number #=> 1600
48
+ address.state #=> nil
49
+
50
+ address = Lite::Address::Parse.parse("5904 Richmond Hwy Ste 340 Alexandria VA 22303-1864")
51
+ address.postal_code_ext #=> 1846
52
+
53
+ address = Lite::Address::Parse.parse("5904 Richmond Hwy Ste 340 Alexandria VA 223031864")
54
+ address.postal_code_ext #=> 1846
55
+ ```
56
+
57
+ ## Formatting
58
+
59
+ A formatted can be returned to as a whole or in parts of simple strings.
60
+
61
+ ```
62
+ address = Lite::Address::Parse.parse("1600 Pennsylvania Ave, Washington, DC, 20500")
63
+ address.to_s #=> 1600 Pennsylvania Ave, Washington, DC 20500
64
+ address.to_s(:line1) #=> 1600 Pennsylvania Ave
65
+ address.to_s(:line2) #=> Washington, DC 20500
66
+ ```
67
+
68
+ You can also format strings to the proper country mail format.
69
+
70
+ ```
71
+ address = Lite::Address::Parse.parse("1600 Pennsylvania Ave, Washington, DC, 20500")
72
+ address.to_snail #=> 1600 Pennsylvania Ave,
73
+ Washington, DC 20500
74
+
75
+ address.to_snail(name: 'John Doe') #=> John Doe
76
+ 1600 Pennsylvania Ave,
77
+ Washington, DC 20500
78
+ ```
79
+
80
+ ## Development
81
+
82
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
83
+
84
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
85
+
86
+ ## Contributing
87
+
88
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lite-address. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
89
+
90
+ ## License
91
+
92
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
93
+
94
+ ## Code of Conduct
95
+
96
+ Everyone interacting in the Lite::Address project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lite-address/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-leap-day
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'lite/address'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here