email_list 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,17 +18,11 @@ class EmailList
18
18
  EMAIL_ADDRESS_EXACT_PATTERN = Regexp.new "\\A#{EMAIL_ADDRESS_SPEC}\\z", nil, 'n'
19
19
 
20
20
  def self.valid?(emails)
21
- split(emails).each do |email|
22
- unless email =~ EMAIL_ADDRESS_EXACT_PATTERN
23
- return false
24
- end
25
- end
26
-
27
- true
21
+ new(emails).valid?
28
22
  end
29
23
 
30
24
  def self.split(emails)
31
- emails.split(/,|;\s?/).map &:strip
25
+ new(emails).emails
32
26
  end
33
27
 
34
28
  include Enumerable
@@ -39,7 +33,7 @@ class EmailList
39
33
  string = '' if string.nil?
40
34
 
41
35
  @string = string
42
- @emails = EmailList.split(@string)
36
+ @emails = @string.split(/,|;\s?/).map &:strip
43
37
  end
44
38
 
45
39
  def each(&block)
@@ -58,4 +52,14 @@ class EmailList
58
52
  end
59
53
  end
60
54
 
55
+ def valid?
56
+ emails.each do |email|
57
+ unless email =~ EMAIL_ADDRESS_EXACT_PATTERN
58
+ return false
59
+ end
60
+ end
61
+
62
+ true
63
+ end
64
+
61
65
  end
@@ -1,3 +1,3 @@
1
1
  class EmailList
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_list
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Guterl
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-27 00:00:00 Z
18
+ date: 2012-03-01 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec