mail_address 1.3.0 → 1.3.1

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
  SHA256:
3
- metadata.gz: 3ac1b18916f09e9ab8d6b774632f191f7eb3cc941df6e96267f4f72aec2fdfe5
4
- data.tar.gz: 19ec24086e0f203ed3c9a18052d82acebd4831d968b25fdc5124ec8ed582302f
3
+ metadata.gz: 6b0a0f8f9570bee5727e30b23812e5e453d134c7b0bd6600bea16d8a77e72d63
4
+ data.tar.gz: aedca5179b75e924bbc4257b51a62e9b0bb9bfaf5568a532006d1c0c327b3201
5
5
  SHA512:
6
- metadata.gz: cb6fecb18ae04b8aa664b870c1c90751ad612c6a78b216c6760df79565b652e5822dd6d29ee0586e47891aaaa8fd70925d38eb6177c0217491df3bf5673f253e
7
- data.tar.gz: 81cd4080f262badace8c5254f91934b7086304f5977308c28461cf87156c47ff4dd65486ff1a78977204dbf33eab0ce9d48630da96bb8b31ce3d9e3dcad2bedc
6
+ metadata.gz: ce591ea386c87a8c7118f46db6ba4b503afe150f67ce8f9fd921f4c31470bba81fefba624d1ee377a6a2c46a5087df1ad9174c7abe79bf3702269809f2bbe4ae
7
+ data.tar.gz: e245562580351606d037c41a618629078ff4d89cd5f59deb3e7b10dd67907a7413d8186feb7cfe61beed77932f932cb726d1c630fc6e1fcdffbab7d2bffe30b7
@@ -12,7 +12,7 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
15
+ ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v4
@@ -25,3 +25,10 @@ jobs:
25
25
 
26
26
  - name: Run tests
27
27
  run: bundle exec rake spec
28
+
29
+ - name: Upload coverage to Coveralls
30
+ if: matrix.ruby-version == '3.4'
31
+ uses: coverallsapp/github-action@v2
32
+ with:
33
+ github-token: ${{ secrets.GITHUB_TOKEN }}
34
+ file: coverage/lcov/mail_address.lcov
data/README.md CHANGED
@@ -1,20 +1,18 @@
1
- # MailAddress [![Build Status](https://travis-ci.org/kizashi1122/mail_address.svg)](https://travis-ci.org/kizashi1122/mail_address) [![Coverage Status](https://coveralls.io/repos/kizashi1122/mail_address/badge.png)](https://coveralls.io/r/kizashi1122/mail_address) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/kizashi1122/mail_address/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/kizashi1122/mail_address/?branch=master)
1
+ # MailAddress [![Test](https://github.com/kizashi1122/mail_address/actions/workflows/test.yml/badge.svg)](https://github.com/kizashi1122/mail_address/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/kizashi1122/mail_address/badge.svg?branch=master)](https://coveralls.io/github/kizashi1122/mail_address?branch=master)
2
2
 
3
- MailAddress is a port of Mail::Address from Perl.
4
-
5
- [mail](https://github.com/mikel/mail) is a great gem library. But some email addresses are unparsable with it. In perl, [Mail::Address](http://search.cpan.org/~markov/MailTools-2.14/lib/Mail/Address.pod) is a very common library to parse email addresses. Mail::Address conviniently can parse even non-RFC-compliant email addresses such as:
3
+ MailAddress is a Ruby port of Perl's [Mail::Address](http://search.cpan.org/~markov/MailTools-2.14/lib/Mail/Address.pod), a widely used email address parser. While the [mail](https://github.com/mikel/mail) gem is excellent, it cannot parse certain email addresses. Mail::Address can conveniently parse even non-RFC-compliant email addresses such as:
6
4
 
7
5
  ```rb
8
6
  # mail gem cannot parse the following addresses
9
7
  Ello [Do Not Reply] <do-not-reply@ello.co> # [, ] are not permitted according to RFC5322
10
8
  大阪 太郎<osaka@example.com> # no whitespace just before `<`
11
9
  ```
12
- But Mail::Address(Perl) has some bad points (below). These are fixed in MailAddress.
10
+ However, Mail::Address (Perl) has some limitations that MailAddress addresses:
13
11
 
14
- - if no ending parenthesis in name part, cannot parse correctly.
15
- - Modifications of name part are too much.
12
+ - Fails to parse correctly when the name part has no closing parenthesis.
13
+ - Over-modifies the name part.
16
14
 
17
- Many people copy and paste email addresses from Excel or the other spreadsheets. In this case, addresses are separated by whitespace(tab or space). To enable to parse this, also ported from a parser part of [Google Closure Library](https://github.com/google/closure-library/blob/master/closure/goog/format/emailaddress.js).
15
+ Many people copy and paste email addresses from Excel or other spreadsheets, where addresses are separated by whitespace (tab or space). To handle this, MailAddress also includes a parser ported from the [Google Closure Library](https://github.com/google/closure-library/blob/master/closure/goog/format/emailaddress.js).
18
16
 
19
17
  ## Installation
20
18
 
@@ -34,8 +32,8 @@ Or install it yourself as:
34
32
 
35
33
  ## Usage
36
34
 
37
- It's almost the same as Mail::Address(Perl).
38
- But in this module, removed `comment` property from address class in version v1.0.0. Most people don't realize comment I think.
35
+ The API is almost the same as Mail::Address (Perl).
36
+ Note that the `comment` property was removed from the address class in v1.0.0, since most users are unlikely to need it.
39
37
 
40
38
  ```rb
41
39
  require 'mail_address'
@@ -60,10 +58,10 @@ p addrs[1].user # "osaka"
60
58
  p addrs[1].original # "大阪 太郎 <osaka@example.jp>"
61
59
  ```
62
60
 
63
- `address.name` and `address.phrase` are almost same.
61
+ `address.name` and `address.phrase` are almost the same.
64
62
  `address.phrase` keeps outermost double quotes or parentheses.
65
63
 
66
- if you specify single email address, you can use `parse_first`.
64
+ If you only need a single address, you can use `parse_first`.
67
65
 
68
66
  ```rb
69
67
  line = "John Doe <john@example.com>"
@@ -83,7 +81,7 @@ addrs = MailAddress.parse_simple(line)
83
81
 
84
82
  ## Contributing
85
83
 
86
- 1. Fork it ( https://github.com/[my-github-username]/mail_address/fork )
84
+ 1. Fork it ( https://github.com/kizashi1122/mail_address/fork )
87
85
  2. Create your feature branch (`git checkout -b my-new-feature`)
88
86
  3. Commit your changes (`git commit -am 'Add some feature'`)
89
87
  4. Push to the branch (`git push origin my-new-feature`)
@@ -20,7 +20,7 @@ module MailAddress
20
20
  end
21
21
 
22
22
  phrase, address, objs = [], [], []
23
- original = ''
23
+ original = ''.dup
24
24
  depth, idx, end_paren_idx = 0, 0, 0
25
25
 
26
26
  tokens = _tokenize lines
@@ -64,7 +64,7 @@ module MailAddress
64
64
  objs.push(o) if o
65
65
  depth = 0
66
66
  end_paren_idx = 0
67
- original = ''
67
+ original = ''.dup
68
68
  _next = _find_next idx+1, tokens, len
69
69
  elsif (depth > 0)
70
70
  token.strip!
@@ -20,7 +20,7 @@ module MailAddress
20
20
 
21
21
  def self.parse_simple(str)
22
22
  result = []
23
- email = token = ''
23
+ email = token = ''.dup
24
24
 
25
25
  # Remove non-UNIX-style newlines that would otherwise cause getToken_ to
26
26
  # choke. Remove multiple consecutive whitespace characters for the same
@@ -33,7 +33,7 @@ module MailAddress
33
33
  if !is_empty_or_whitespace(email)
34
34
  result.push(parse_internal(email))
35
35
  end
36
- email = ''
36
+ email = ''.dup
37
37
  i += 1
38
38
  next
39
39
  end
@@ -49,8 +49,8 @@ module MailAddress
49
49
  end
50
50
 
51
51
  def self.parse_internal(addr)
52
- name = ''
53
- address = ''
52
+ name = ''.dup
53
+ address = ''.dup
54
54
  i = 0
55
55
  while i < addr.length
56
56
  token = get_token(addr, i)
@@ -1,3 +1,3 @@
1
1
  module MailAddress
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
data/mail_address.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.description = "A practical mail address parser implemented based on Perl Module Mail::Address."
12
12
  spec.homepage = "https://github.com/kizashi1122/mail_address"
13
13
  spec.license = "MIT"
14
+ spec.required_ruby_version = '>= 2.7'
14
15
 
15
16
  spec.files = `git ls-files -z`.split("\x0")
16
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -20,5 +21,6 @@ Gem::Specification.new do |spec|
20
21
  spec.add_development_dependency "bundler", "~> 2.1"
21
22
  spec.add_development_dependency "rake", "~> 13.0"
22
23
  spec.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
23
- spec.add_development_dependency "coveralls"
24
+ spec.add_development_dependency "simplecov", "~> 0.22"
25
+ spec.add_development_dependency "simplecov-lcov", "~> 0.8"
24
26
  end
data/spec/spec_helper.rb CHANGED
@@ -1,18 +1,16 @@
1
1
  require 'simplecov'
2
2
 
3
- begin
4
- require 'coveralls'
5
- Coveralls.wear! do
6
- add_filter '.bundle/'
7
- end
3
+ if ENV['CI']
4
+ require 'simplecov-lcov'
5
+ SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
8
6
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
9
7
  SimpleCov::Formatter::HTMLFormatter,
10
- Coveralls::SimpleCov::Formatter
8
+ SimpleCov::Formatter::LcovFormatter
11
9
  ])
12
- rescue LoadError
13
- SimpleCov.start do
14
- add_filter '.bundle/'
15
- end
10
+ end
11
+
12
+ SimpleCov.start do
13
+ add_filter '.bundle/'
16
14
  end
17
15
 
18
16
  require 'rubygems'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_address
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kizashi Nagata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-23 00:00:00.000000000 Z
11
+ date: 2026-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,19 +59,33 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: 3.1.0
61
61
  - !ruby/object:Gem::Dependency
62
- name: coveralls
62
+ name: simplecov
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '0.22'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.22'
75
+ - !ruby/object:Gem::Dependency
76
+ name: simplecov-lcov
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.8'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '0'
88
+ version: '0.8'
75
89
  description: A practical mail address parser implemented based on Perl Module Mail::Address.
76
90
  email:
77
91
  - kizashi1122@gmail.com
@@ -110,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
124
  requirements:
111
125
  - - ">="
112
126
  - !ruby/object:Gem::Version
113
- version: '0'
127
+ version: '2.7'
114
128
  required_rubygems_version: !ruby/object:Gem::Requirement
115
129
  requirements:
116
130
  - - ">="