ruby_email 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9336b115b34288f687047ab217a43a4386d836cc
4
- data.tar.gz: 4937586b0ca515185805c253713b902413b512ab
3
+ metadata.gz: cb0c82b4013b33854d71d9f434b3b2c74ec633a5
4
+ data.tar.gz: 515ce7795e8f86984d09651a2adbaa8f0f44a38d
5
5
  SHA512:
6
- metadata.gz: 6786779653b217743b5b80400e420df8ec57dc7804039488ad799568da425ab202145691d230f7d2ad5273f7a3e83ec46bd8c4b0b6a4946096bb17ff2bb87a20
7
- data.tar.gz: bbc10d88a8309cdb754bd6a11b4fa50f91e920ae9ff40ed3e1ad57ae820d6c11baccb192a0b9932a37b6344064571961b71955508fd8ae3ea7caa914a8fe4021
6
+ metadata.gz: 5c8c48fc64c5eb10fcb2e4d312ff78e159774c4fe03c77c042cb490b4ccdd548a04dae0763d83b7dd2756ad82a0d0d68dbd9ae444a03a81579ba8432a21c3ec3
7
+ data.tar.gz: aae07e1346703f0b7ae00031c52bc706ad845e2889a46525a095a27f7d454b9106cc5669d2c6a5c384b0eb1765d740623b2e6133441838a1b17bcf924d76638e
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.1.5
2
+ * Split into files each feature (core, public, f/string)
3
+
1
4
  v0.1.4
2
5
  * Add public features (to check if the email is valid on the internet)
3
6
 
@@ -0,0 +1,5 @@
1
+ require_relative '../core'
2
+
3
+ class String
4
+ include RubyEmail::String
5
+ end
@@ -0,0 +1,39 @@
1
+ # http://www.ietf.org/rfc/rfc5322.txt
2
+ module RubyEmail
3
+ # one valid character (not . because used to separe domains)
4
+ ATEXT = '([A-Za-z0-9!#\$%&\'*\+\-/=\?\^_`\{\}\|~])'
5
+ ATOM = "#{ATEXT}+"
6
+ DOT_ATOM_TEXT = "(#{ATOM})(\\.#{ATOM})*"
7
+ # email grammar
8
+ VALIDE = "(?<local>#{DOT_ATOM_TEXT})@(?<domain>#{DOT_ATOM_TEXT})"
9
+ # regexp to validate complete email
10
+ REGEXP = Regexp.new "\\A#{VALIDE}\\Z"
11
+
12
+ # Check if the {::String} is a valid email
13
+ # @param str [::String] string to match
14
+ # @raise [ArgumentError] if str is not a String
15
+ # @return [TrueClass or FalseClass]
16
+ def self.validates? str
17
+ !!match(str)
18
+ end
19
+
20
+ # Check if the string is a valid email and details how
21
+ # @param str [::String] string to match
22
+ # @raise [ArgumentError] if str is not a String
23
+ # @return [MatchData or NilClass] matched email with the keys "local" and "domain"
24
+ def self.match str
25
+ raise ArgumentError, "Cannot validate a `#{str.class}`. Only `String` can be." unless str.is_a?(String)
26
+ str.match(REGEXP)
27
+ end
28
+
29
+ # included by {::String}
30
+ module String
31
+ # Check if the current [::String] instance is a valid email
32
+ # @return [TrueClass or FalseClass]
33
+ def is_email?
34
+ RubyEmail.validates? self
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,5 @@
1
+ require_relative '../public'
2
+
3
+ class String
4
+ include RubyEmail::Public::String
5
+ end
@@ -0,0 +1,43 @@
1
+ require_relative 'core'
2
+
3
+ # http://www.ietf.org/rfc/rfc5322.txt
4
+ module RubyEmail
5
+
6
+ # Only valid on the public internet. "toto@toto" is not valid, but "toto@toto.toto" is good
7
+ module Public
8
+ # one valid character (not . because used to separe domains)
9
+ ATEXT = '([A-Za-z0-9!#\$%&\'*\+\-/=\?\^_`\{\}\|~])'
10
+ ATOM = "#{ATEXT}+"
11
+ DOT_ATOM_TEXT = "(#{ATOM})(\\.#{ATOM})*"
12
+ VALIDE = "(?<local>#{DOT_ATOM_TEXT})@(?<domain>#{DOT_ATOM_TEXT}\\.#{DOT_ATOM_TEXT})"
13
+ REGEXP = Regexp.new "\\A#{VALIDE}\\Z"
14
+
15
+ # Check if the {::String} is a valid email on internet
16
+ # @param str [::String] string to match
17
+ # @raise [ArgumentError] if str is not a String
18
+ # @return [TrueClass or FalseClass]
19
+ def self.validates? str
20
+ !!match(str)
21
+ end
22
+
23
+ # Check if the string is a valid email on internet and details how
24
+ # @param str [::String] string to match
25
+ # @raise [ArgumentError] if str is not a String
26
+ # @return [MatchData or NilClass] matched email with the keys "local" and "domain"
27
+ def self.match str
28
+ raise ArgumentError, "Cannot validate a `#{str.class}`. Only `String` can be." unless str.is_a?(String)
29
+ str.match(REGEXP)
30
+ end
31
+
32
+ # included by {::String}
33
+ module String
34
+ # Check if the current [::String] instance is a valid email on internet
35
+ # @return [TrueClass or FalseClass]
36
+ def is_public_email?
37
+ RubyEmail::Public.validates? self
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end
data/lib/ruby_email.rb CHANGED
@@ -1,72 +1,5 @@
1
- # http://www.ietf.org/rfc/rfc5322.txt
2
- module RubyEmail
3
- # one valid character (not . because used to separe domains)
4
- ATEXT = '([A-Za-z0-9!#\$%&\'*\+\-/=\?\^_`\{\}\|~])'
5
- ATOM = "#{ATEXT}+"
6
- DOT_ATOM_TEXT = "(#{ATOM})(\\.#{ATOM})*"
7
- # email grammar
8
- VALIDE = "(?<local>#{DOT_ATOM_TEXT})@(?<domain>#{DOT_ATOM_TEXT})"
9
- # regexp to validate complete email
10
- REGEXP = Regexp.new "\\A#{VALIDE}\\Z"
1
+ require_relative 'ruby_email/core'
2
+ require_relative 'ruby_email/core/string'
11
3
 
12
- # Check if the {::String} is a valid email
13
- # @param str [::String] string to match
14
- # @raise [ArgumentError] if str is not a String
15
- # @return [TrueClass or FalseClass]
16
- def self.validates? str
17
- !!match(str)
18
- end
19
-
20
- # Check if the string is a valid email and details how
21
- # @param str [::String] string to match
22
- # @raise [ArgumentError] if str is not a String
23
- # @return [MatchData or NilClass] matched email with the keys "local" and "domain"
24
- def self.match str
25
- raise ArgumentError, "Cannot validate a `#{str.class}`. Only `String` can be." unless str.is_a?(String)
26
- str.match(REGEXP)
27
- end
28
-
29
- # Only valid on the public internet. "toto@toto" is not valid, but "toto@toto.toto" is good
30
- module Public
31
- VALIDE = "(?<local>#{DOT_ATOM_TEXT})@(?<domain>#{DOT_ATOM_TEXT}\\.#{DOT_ATOM_TEXT})"
32
- REGEXP = Regexp.new "\\A#{VALIDE}\\Z"
33
-
34
- # Check if the {::String} is a valid email on internet
35
- # @param str [::String] string to match
36
- # @raise [ArgumentError] if str is not a String
37
- # @return [TrueClass or FalseClass]
38
- def self.validates? str
39
- !!match(str)
40
- end
41
-
42
- # Check if the string is a valid email on internet and details how
43
- # @param str [::String] string to match
44
- # @raise [ArgumentError] if str is not a String
45
- # @return [MatchData or NilClass] matched email with the keys "local" and "domain"
46
- def self.match str
47
- raise ArgumentError, "Cannot validate a `#{str.class}`. Only `String` can be." unless str.is_a?(String)
48
- str.match(REGEXP)
49
- end
50
- end
51
-
52
-
53
- # included by {::String}
54
- module String
55
- # Check if the current [::String] instance is a valid email
56
- # @return [TrueClass or FalseClass]
57
- def is_email?
58
- RubyEmail.validates? self
59
- end
60
-
61
- # Check if the current [::String] instance is a valid email on internet
62
- # @return [TrueClass or FalseClass]
63
- def is_public_email?
64
- RubyEmail::Public.validates? self
65
- end
66
- end
67
-
68
- end
69
-
70
- class String
71
- include RubyEmail::String
72
- end
4
+ require_relative 'ruby_email/public'
5
+ require_relative 'ruby_email/public/string'
data/ruby_email.gemspec CHANGED
@@ -8,6 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.email = ['arthur.poulet@mailoo.org']
9
9
  s.files = %w(
10
10
  lib/ruby_email.rb
11
+ lib/ruby_email/core.rb
12
+ lib/ruby_email/core/string.rb
13
+ lib/ruby_email/public.rb
14
+ lib/ruby_email/public/string.rb
11
15
 
12
16
  README.md
13
17
  CHANGELOG
data/version CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data.tar.gz.sig CHANGED
@@ -1 +1,3 @@
1
- =����7���b��G��� JZt�� 1,�R)@DeS�c:�p(���hN儂=�XH�A�
1
+ Y,h;or���Q�;ZgI
2
+ ����ۡ�e�� �yS!��^�$c����ӟ���+����!���4uJ�G�Kʇ�5�r]%���VL�m@!�
3
+ ����A��,�$�O���J�u=簆��*O�����G7\��@Smv��* �P��@�� ׵vC�Hْ�5*^����%�z
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nephos (poulet_a)
@@ -60,6 +60,10 @@ files:
60
60
  - README.md
61
61
  - Rakefile
62
62
  - lib/ruby_email.rb
63
+ - lib/ruby_email/core.rb
64
+ - lib/ruby_email/core/string.rb
65
+ - lib/ruby_email/public.rb
66
+ - lib/ruby_email/public/string.rb
63
67
  - ruby_email.gemspec
64
68
  - test/unit_test.rb
65
69
  - version
metadata.gz.sig CHANGED
Binary file