mail_address 1.2.11 → 1.2.12
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/lib/mail_address/mail_address.rb +3 -3
- data/lib/mail_address/version.rb +1 -1
- data/spec/mail_address_spec.rb +19 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5f8bcbb9b80a72e4e705ec0f9582198d7181e5c
|
|
4
|
+
data.tar.gz: 41e6ec3c950564d41276bbb3b8b7f8bceb428bbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 611d76ecba7ccab104df32837297399acb762b2f64f922669c64e59f02e1da4edd2ac30d36a8e84f0b3eb91110b8423b7db0b94406a574769edb43c16f2de09c
|
|
7
|
+
data.tar.gz: 092cb243fc6d6220d189a5448b0548f28713ff04491e95642ea9502fafa872f4c1ee1cb3e8494460648f2541a9630c537944c52f26674a55b18135ae0e21db03
|
|
@@ -3,10 +3,10 @@ module MailAddress
|
|
|
3
3
|
|
|
4
4
|
def self.parse(*addresses)
|
|
5
5
|
lines = addresses.grep(String)
|
|
6
|
-
line = lines.join('')
|
|
6
|
+
line = lines.join('').strip
|
|
7
7
|
|
|
8
|
-
# empty
|
|
9
|
-
if line.
|
|
8
|
+
# empty or <> or < or >
|
|
9
|
+
if line.empty? || line.match(/\A[<>;, ]+\z/)
|
|
10
10
|
return [ MailAddress::Address.new(line, nil, line) ]
|
|
11
11
|
end
|
|
12
12
|
|
data/lib/mail_address/version.rb
CHANGED
data/spec/mail_address_spec.rb
CHANGED
|
@@ -491,7 +491,10 @@ describe MailAddress do
|
|
|
491
491
|
it "obviously invalid address (has no '@')" do
|
|
492
492
|
array = [
|
|
493
493
|
'recipient list not shown: ;',
|
|
494
|
-
'各位:;'
|
|
494
|
+
'各位:;',
|
|
495
|
+
'<>',
|
|
496
|
+
'<',
|
|
497
|
+
'>',
|
|
495
498
|
]
|
|
496
499
|
|
|
497
500
|
array.each do |line|
|
|
@@ -507,6 +510,21 @@ describe MailAddress do
|
|
|
507
510
|
end
|
|
508
511
|
end
|
|
509
512
|
|
|
513
|
+
it "only separator" do
|
|
514
|
+
array = [',', ';', ',;', ',,', ';;;', '<;,>, <>']
|
|
515
|
+
|
|
516
|
+
array.each do |line|
|
|
517
|
+
results = MailAddress.parse(line)
|
|
518
|
+
expect(results[0].format).to eq(line)
|
|
519
|
+
expect(results[0].address).to be_nil
|
|
520
|
+
expect(results[0].name).to eq(line.strip)
|
|
521
|
+
expect(results[0].phrase).to eq(line)
|
|
522
|
+
expect(results[0].host).to be_nil
|
|
523
|
+
expect(results[0].user).to eq('')
|
|
524
|
+
expect(results[0].original).to eq(line)
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
|
|
510
528
|
it "all are invalid" do
|
|
511
529
|
line = 'aa aa, bb (bb), cccc'
|
|
512
530
|
results = MailAddress.parse(line)
|
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.
|
|
4
|
+
version: 1.2.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kizashi Nagata
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|