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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG +3 -0
- data/lib/ruby_email/core/string.rb +5 -0
- data/lib/ruby_email/core.rb +39 -0
- data/lib/ruby_email/public/string.rb +5 -0
- data/lib/ruby_email/public.rb +43 -0
- data/lib/ruby_email.rb +4 -71
- data/ruby_email.gemspec +4 -0
- data/version +1 -1
- data.tar.gz.sig +3 -1
- metadata +5 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb0c82b4013b33854d71d9f434b3b2c74ec633a5
|
4
|
+
data.tar.gz: 515ce7795e8f86984d09651a2adbaa8f0f44a38d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c8c48fc64c5eb10fcb2e4d312ff78e159774c4fe03c77c042cb490b4ccdd548a04dae0763d83b7dd2756ad82a0d0d68dbd9ae444a03a81579ba8432a21c3ec3
|
7
|
+
data.tar.gz: aae07e1346703f0b7ae00031c52bc706ad845e2889a46525a095a27f7d454b9106cc5669d2c6a5c384b0eb1765d740623b2e6133441838a1b17bcf924d76638e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
@@ -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,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
|
-
|
2
|
-
|
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
|
-
|
13
|
-
|
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
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data.tar.gz.sig
CHANGED
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
|
+
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
|