mail_address 1.2.16 → 1.2.20

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
- SHA1:
3
- metadata.gz: 9444cdca2ba62456c8945411801b4dca251a7d44
4
- data.tar.gz: a939e18eaab3b80c2a1d826a834e8493ba0432cb
2
+ SHA256:
3
+ metadata.gz: 11efdd5a61a85e9557f4d6b51371aac1aeb222d87e8439b08f65f22283909f23
4
+ data.tar.gz: 38c1f50d38c14b688b5839c6203dd2200dd20d4581ed77129bad1f7828c09ef5
5
5
  SHA512:
6
- metadata.gz: fff818a9427ae13526871ba23b78c1bd1f5a91731a14bbee503a8c547df397ab8fda5dfd04d13f5e72cbd70488bce4d4ee51783c6a3c3f8e1f808bddd188a83f
7
- data.tar.gz: facfc66055775d9cd3393f9446591716386f9e82b9cc247ed210fe5bb02c51e3eb83ce956c8ed9dca02560982c30f9fa9ea78ea8508d7a3d49d3d8895cbac591
6
+ metadata.gz: 45d4af2ecbca6933e76471dd07b2a91a5cb266ce7a9d22f386f0b8ffc0b0f3a5f13fffad028b771accc46a4e3afc052ce71440e2ee82c2205a10d6fda9e81b06
7
+ data.tar.gz: fc20c95ea8c293e0375280ce5ed63a857ced78d9b81d3ec991a3cca695bac65a4a31d568dced459ce183de4bc727ce2c6b06cf70ecd88fef66bddae844a78a84
data/README.md CHANGED
@@ -35,7 +35,7 @@ Or install it yourself as:
35
35
  ## Usage
36
36
 
37
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 reallize comment I think.
38
+ But in this module, removed `comment` property from address class in version v1.0.0. Most people don't realize comment I think.
39
39
 
40
40
  ```rb
41
41
  require 'mail_address'
@@ -10,7 +10,7 @@ module MailAddress
10
10
  line = lines.join('').strip
11
11
 
12
12
  # empty or <> or < or >
13
- if line.empty? || line.match(/\A[<>;, ]+\z/)
13
+ if line.empty? || line.match(/\A[<>;, \\]+\z/)
14
14
  return [ MailAddress::Address.new(line, nil, line) ]
15
15
  end
16
16
 
@@ -12,10 +12,10 @@ module MailAddress
12
12
  # CHARS_REQUIRE_QUOTES_ = SPECIAL_CHARS + ADDRESS_SEPARATORS_
13
13
  ESCAPED_DOUBLE_QUOTES_ = /\\\"/
14
14
  ESCAPED_BACKSLASHES_ = /\\\\/
15
- QUOTED_REGEX_STR_ = '[+a-zA-Z0-9_.!#$%&\'*\\/=?^`{|}~-]+'
15
+ QUOTED_REGEX_STR_ = '[+a-zA-Z0-9_.!#$%&\'*\\/=?^`{|}~\-]+'
16
16
  UNQUOTED_REGEX_STR_ = '"' + QUOTED_REGEX_STR_ + '"'
17
17
  LOCAL_PART_REGEXP_STR_ = '(?:' + QUOTED_REGEX_STR_ + '|' + UNQUOTED_REGEX_STR_ + ')'
18
- DOMAIN_PART_REGEXP_STR_ = '([a-zA-Z0-9-]+\\.)+[a-zA-Z0-9]{2,63}'
18
+ DOMAIN_PART_REGEXP_STR_ = '([a-zA-Z0-9\-_]+\\.)+[a-zA-Z0-9]{2,63}'
19
19
  EMAIL_ADDRESS_ = Regexp.new('\\A' + LOCAL_PART_REGEXP_STR_ + '@' + DOMAIN_PART_REGEXP_STR_ + '\\z')
20
20
 
21
21
  def self.parse_simple(str)
@@ -1,3 +1,3 @@
1
1
  module MailAddress
2
- VERSION = "1.2.16"
2
+ VERSION = "1.2.20"
3
3
  end
data/mail_address.gemspec CHANGED
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "bundler", "~> 2.1"
22
+ spec.add_development_dependency "rake", "~> 13.0"
23
23
  spec.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
24
24
  spec.add_development_dependency "coveralls"
25
25
  end
@@ -23,6 +23,19 @@ describe MailAddress do
23
23
  expect(result.user).to eq('johndoe')
24
24
  expect(result.original).to eq(line)
25
25
 
26
+ # subdomain has underscore(s) (not common though)
27
+ line = 'johndoe@sub_domain.example.com'
28
+ result = MailAddress.parse_first(line)
29
+ expect(result.format).to eq('johndoe@sub_domain.example.com')
30
+ expect(result.format(true)).to eq('johndoe@sub_domain.example.com')
31
+ expect(result.address).to eq('johndoe@sub_domain.example.com')
32
+ expect(result.name).to be_nil
33
+ expect(result.phrase).to eq('')
34
+ expect(result.host).to eq('sub_domain.example.com')
35
+ expect(result.user).to eq('johndoe')
36
+ expect(result.original).to eq(line)
37
+
38
+
26
39
  # <address> only
27
40
  line = '<johndoe@example.com>'
28
41
  result = MailAddress.parse_first(line)
@@ -582,6 +595,16 @@ describe MailAddress do
582
595
  end
583
596
 
584
597
  it "includes backslash" do
598
+ line = '\\'
599
+ result = MailAddress.parse_first(line)
600
+ expect(result.format).to eq('\\')
601
+ expect(result.address).to be_nil
602
+ expect(result.name).to be_nil
603
+ expect(result.phrase).to eq('\\')
604
+ expect(result.host).to be_nil
605
+ expect(result.user).to eq('')
606
+ expect(result.original).to eq('\\')
607
+
585
608
  line = '\"jjjjjjjjjjjj\" <john_doe@example.com>'
586
609
  result = MailAddress.parse_first(line)
587
610
  expect(result.format).to eq('jjjjjjjjjjjj <john_doe@example.com>')
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
1
  require 'spec_helper'
3
- require 'pp'
4
2
 
5
3
  #
6
4
  # These tests are almost ports of the following test code:
@@ -101,4 +99,10 @@ describe MailAddress do
101
99
  'Failed to parse pre-OS X Mac newlines');
102
100
  end
103
101
 
102
+ context "subdomain has underscore(s)" do
103
+ it "permits as an email address" do
104
+ assert_parsed_list("a@sub_domain.example.com", ['a@sub_domain.example.com'], 'OK');
105
+ end
106
+ end
107
+
104
108
  end
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.2.16
4
+ version: 1.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kizashi Nagata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-09 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.5.2
119
+ rubygems_version: 3.1.2
121
120
  signing_key:
122
121
  specification_version: 4
123
122
  summary: Simple Mail Address Parser