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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d67fc9dcb029713e9f3ab3f7062f62caed4b326a
4
- data.tar.gz: 41beda1941bba712ecfeb33e6a4563227dfdf0e7
3
+ metadata.gz: e5f8bcbb9b80a72e4e705ec0f9582198d7181e5c
4
+ data.tar.gz: 41e6ec3c950564d41276bbb3b8b7f8bceb428bbc
5
5
  SHA512:
6
- metadata.gz: a9ac723394f3a5ae59910286573190cf31048ef999e000e386abcf4d88338e33e2b2264449ba0babab2a7e7b8ce1d4894991376fe3cb789f64230f4a2aa2c5f2
7
- data.tar.gz: 44d8258acc2f77c92bae134a19b315b762709e8763123acc63316f130bfc665d4811c4935ae381f25ba1c27b798f0e3aee13b03f09933913ed7d2b743d3559f6
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.strip.empty?
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
 
@@ -1,3 +1,3 @@
1
1
  module MailAddress
2
- VERSION = "1.2.11"
2
+ VERSION = "1.2.12"
3
3
  end
@@ -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.11
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-08-03 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler