mail_address 1.2.13 → 1.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mail_address/address.rb +5 -5
- data/lib/mail_address/version.rb +1 -1
- data/spec/mail_address_spec.rb +24 -18
- data/spec/simple_parser_spec.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 421e1293f8cc6a196e5d2bbacad2b5d390cb8ad9
|
4
|
+
data.tar.gz: 5a80cd717ed0e48c76f0f6d3c2e8eca478f2f85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2ab6254e7914a045e3a41fa57450d8cffb4786d7d29ba4923fb10a7edead3994d11808f91a20e9003023f4cbc5bb3440cf7c0c10377d8f4c76a42b28256d0ae
|
7
|
+
data.tar.gz: 72411a7bbba88e8617b36a90d0c811d2abc3336aaa57ae5bae1ce48814bc63473376baba4f21d48c4625b66d1debf37a34efeba75dc42e71d36ddeb5ff6a16f6
|
data/lib/mail_address/address.rb
CHANGED
@@ -28,17 +28,17 @@ module MailAddress
|
|
28
28
|
email_address = enquote ? quoted_address : @address
|
29
29
|
|
30
30
|
if !@phrase.nil? && @phrase.length > 0 then
|
31
|
-
if @phrase.match(/\A\(/) && @phrase.match(/\)\z/)
|
32
|
-
|
33
|
-
|
34
|
-
else
|
31
|
+
# if @phrase.match(/\A\(/) && @phrase.match(/\)\z/)
|
32
|
+
# addr.push(email_address) if !@address.nil? && @address.length > 0
|
33
|
+
# addr.push(@phrase)
|
34
|
+
# else
|
35
35
|
addr.push(
|
36
36
|
@phrase.match(/^(?:\s*#{ATEXT}\s*)+$/) ? @phrase
|
37
37
|
: @phrase.match(/(?<!\\)"/) ? @phrase
|
38
38
|
: %Q("#{@phrase}")
|
39
39
|
)
|
40
40
|
addr.push "<#{email_address}>" if !@address.nil? && @address.length > 0
|
41
|
-
end
|
41
|
+
# end
|
42
42
|
elsif !@address.nil? && @address.length > 0 then
|
43
43
|
addr.push(email_address)
|
44
44
|
end
|
data/lib/mail_address/version.rb
CHANGED
data/spec/mail_address_spec.rb
CHANGED
@@ -91,8 +91,10 @@ describe MailAddress do
|
|
91
91
|
# address + (note)
|
92
92
|
line = 'johndoe@example.com (John Doe)'
|
93
93
|
results = MailAddress.parse(line)
|
94
|
-
expect(results[0].format).to eq('johndoe@example.com (John Doe)')
|
95
|
-
expect(results[0].format(true)).to eq('johndoe@example.com (John Doe)')
|
94
|
+
# expect(results[0].format).to eq('johndoe@example.com (John Doe)')
|
95
|
+
# expect(results[0].format(true)).to eq('johndoe@example.com (John Doe)')
|
96
|
+
expect(results[0].format).to eq('"(John Doe)" <johndoe@example.com>')
|
97
|
+
expect(results[0].format(true)).to eq('"(John Doe)" <johndoe@example.com>')
|
96
98
|
expect(results[0].address).to eq('johndoe@example.com')
|
97
99
|
expect(results[0].name).to eq('John Doe')
|
98
100
|
expect(results[0].phrase).to eq('(John Doe)')
|
@@ -103,8 +105,10 @@ describe MailAddress do
|
|
103
105
|
# address + (note) # nested paren
|
104
106
|
line = 'johndoe@example.com (John (Mid) Doe)'
|
105
107
|
results = MailAddress.parse(line)
|
106
|
-
expect(results[0].format).to eq('johndoe@example.com (John (Mid) Doe)')
|
107
|
-
expect(results[0].format(true)).to eq('johndoe@example.com (John (Mid) Doe)')
|
108
|
+
# expect(results[0].format).to eq('johndoe@example.com (John (Mid) Doe)')
|
109
|
+
# expect(results[0].format(true)).to eq('johndoe@example.com (John (Mid) Doe)')
|
110
|
+
expect(results[0].format).to eq('"(John (Mid) Doe)" <johndoe@example.com>')
|
111
|
+
expect(results[0].format(true)).to eq('"(John (Mid) Doe)" <johndoe@example.com>')
|
108
112
|
expect(results[0].address).to eq('johndoe@example.com')
|
109
113
|
expect(results[0].name).to eq('John (Mid) Doe')
|
110
114
|
expect(results[0].phrase).to eq('(John (Mid) Doe)')
|
@@ -115,8 +119,10 @@ describe MailAddress do
|
|
115
119
|
# address + (note) # note has special char
|
116
120
|
line = 'johndoe@example.com (John@Doe)'
|
117
121
|
results = MailAddress.parse(line)
|
118
|
-
expect(results[0].format).to eq('johndoe@example.com (John@Doe)')
|
119
|
-
expect(results[0].format(true)).to eq('johndoe@example.com (John@Doe)')
|
122
|
+
# expect(results[0].format).to eq('johndoe@example.com (John@Doe)')
|
123
|
+
# expect(results[0].format(true)).to eq('johndoe@example.com (John@Doe)')
|
124
|
+
expect(results[0].format).to eq('"(John@Doe)" <johndoe@example.com>')
|
125
|
+
expect(results[0].format(true)).to eq('"(John@Doe)" <johndoe@example.com>')
|
120
126
|
expect(results[0].address).to eq('johndoe@example.com')
|
121
127
|
expect(results[0].name).to eq('John@Doe')
|
122
128
|
expect(results[0].phrase).to eq('(John@Doe)')
|
@@ -126,8 +132,10 @@ describe MailAddress do
|
|
126
132
|
|
127
133
|
line = 'johndoe@example.com (John, Doe)'
|
128
134
|
results = MailAddress.parse(line)
|
129
|
-
expect(results[0].format).to eq('johndoe@example.com (John, Doe)')
|
130
|
-
expect(results[0].format(true)).to eq('johndoe@example.com (John, Doe)')
|
135
|
+
# expect(results[0].format).to eq('johndoe@example.com (John, Doe)')
|
136
|
+
# expect(results[0].format(true)).to eq('johndoe@example.com (John, Doe)')
|
137
|
+
expect(results[0].format).to eq('"(John, Doe)" <johndoe@example.com>')
|
138
|
+
expect(results[0].format(true)).to eq('"(John, Doe)" <johndoe@example.com>')
|
131
139
|
expect(results[0].address).to eq('johndoe@example.com')
|
132
140
|
expect(results[0].name).to eq('John, Doe')
|
133
141
|
expect(results[0].phrase).to eq('(John, Doe)')
|
@@ -707,13 +715,13 @@ describe MailAddress do
|
|
707
715
|
# '"JAMES R. TWINE - THE NERD" <TWINE57%SDELVB%SNYDELVA.bitnet@CUNYVM.CUNY.EDU>',
|
708
716
|
# 'James R. Twine - The Nerd'],
|
709
717
|
[ 'bilsby@signal.dra (Fred C. M. Bilsby)',
|
710
|
-
'
|
718
|
+
'"(Fred C. M. Bilsby)" <bilsby@signal.dra>',
|
711
719
|
'Fred C. M. Bilsby'],
|
712
720
|
# [ '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk', ### not supported
|
713
721
|
# '/G=Owen/S=Smith/O=SJ-Research/ADMD=INTERSPAN/C=GB/@mhs-relay.ac.uk',
|
714
722
|
# 'Owen Smith'],
|
715
723
|
[ 'apardon@rc1.vub.ac.be (Antoon Pardon)',
|
716
|
-
'apardon@rc1.vub.ac.be
|
724
|
+
'"(Antoon Pardon)" <apardon@rc1.vub.ac.be>',
|
717
725
|
'Antoon Pardon'],
|
718
726
|
# ['"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>',
|
719
727
|
# '"Stephen Burke, Liverpool" <BURKE@vxdsya.desy.de>',
|
@@ -728,13 +736,13 @@ describe MailAddress do
|
|
728
736
|
'The Newcastle Info-Server <info-admin@newcastle.ac.uk>',
|
729
737
|
'The Newcastle Info-Server'],
|
730
738
|
['wsinda@nl.tue.win.info (Dick Alstein)',
|
731
|
-
'wsinda@nl.tue.win.info
|
739
|
+
'"(Dick Alstein)" <wsinda@nl.tue.win.info>',
|
732
740
|
'Dick Alstein'],
|
733
741
|
['mserv@rusmv1.rus.uni-stuttgart.de (RUS Mail Server)',
|
734
|
-
'mserv@rusmv1.rus.uni-stuttgart.de
|
742
|
+
'"(RUS Mail Server)" <mserv@rusmv1.rus.uni-stuttgart.de>',
|
735
743
|
'RUS Mail Server'],
|
736
744
|
['Suba.Peddada@eng.sun.com (Suba Peddada [CONTRACTOR])',
|
737
|
-
'Suba.Peddada@eng.sun.com
|
745
|
+
'"(Suba Peddada [CONTRACTOR])" <Suba.Peddada@eng.sun.com>',
|
738
746
|
'Suba Peddada'],
|
739
747
|
['ftpmail-adm@info2.rus.uni-stuttgart.de',
|
740
748
|
'ftpmail-adm@info2.rus.uni-stuttgart.de',
|
@@ -779,13 +787,13 @@ describe MailAddress do
|
|
779
787
|
'Jeffrey A Law <law@snake.cs.utah.edu>',
|
780
788
|
'Jeffrey A Law'],
|
781
789
|
['lidl@uunet.uu.net (Kurt J. Lidl)',
|
782
|
-
'
|
790
|
+
'"(Kurt J. Lidl)" <lidl@uunet.uu.net>',
|
783
791
|
'Kurt J. Lidl'],
|
784
792
|
['Kresten_Thorup@NeXT.COM (Kresten Krab Thorup)',
|
785
|
-
'
|
793
|
+
'"(Kresten Krab Thorup)" <Kresten_Thorup@NeXT.COM>',
|
786
794
|
'Kresten Krab Thorup'],
|
787
795
|
['hjl@nynexst.com (H.J. Lu)',
|
788
|
-
'
|
796
|
+
'"(H.J. Lu)" <hjl@nynexst.com>',
|
789
797
|
'H.J. Lu'],
|
790
798
|
# ['@oleane.net:hugues@afp.com a!b@c.d foo!bar!foobar!root',
|
791
799
|
# '@oleane.net:hugues@afp.com',
|
@@ -819,5 +827,3 @@ describe MailAddress do
|
|
819
827
|
end
|
820
828
|
end
|
821
829
|
end
|
822
|
-
|
823
|
-
|
data/spec/simple_parser_spec.rb
CHANGED
@@ -61,6 +61,10 @@ describe MailAddress do
|
|
61
61
|
# expect(res[1].phrase).to eq('g"h"i\\')
|
62
62
|
end
|
63
63
|
|
64
|
+
it "aaaaaaaaaaaaa" do
|
65
|
+
res = assert_parsed_list( '(*^^*)(・・;) <vermilion.lv22@gmail.com>', ['vermilion.lv22@gmail.com'] )
|
66
|
+
end
|
67
|
+
|
64
68
|
it "testparseListWithCommaInLocalPart" do
|
65
69
|
res = assert_parsed_list(
|
66
70
|
'"Doe, John" <doe.john@gmail.com>, <someone@gmail.com>, "あいうえお" <abc@example.com>, かき くけこ <xyz@example.com>',
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kizashi Nagata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.5.1
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Simple Mail Address Parser
|