ruby_email 0.2.1 → 0.2.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG +3 -0
- data/README.md +8 -8
- data/lib/ruby_email/rfc1123.rb +3 -2
- data/lib/ruby_email/rfc5322.rb +1 -0
- data/test/rfc1123.rb +6 -17
- data/test/rfc5322.rb +0 -17
- data/test/unit_test.rb +3 -1
- data/version +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 6ddad11ccb4144bd5bad65ca9bc92e8f790fdfd9
|
4
|
+
data.tar.gz: 3f82921b53c852986b0b1a033531e8beee214791
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdc8fcd386b82b5c4b4ff997d6b7b8ba36109cf07eebb7fa9f812b71fd867e87ab90d9fa1301219804d264a092325c53f94ddb6d55f394c5dc70d39f3f0d5eed
|
7
|
+
data.tar.gz: a1c16a694d68f27b8955554b681279c7bf4bb9e375a08e7b9e5d4cc957d16bfcf351f43cae31c87ffe82818597ceeb9935b492c960b05c001f594d51e9fed64c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -28,14 +28,14 @@ gem 'ruby_email'
|
|
28
28
|
require 'ruby_email'
|
29
29
|
|
30
30
|
# Pure Rfc5322
|
31
|
-
RubyEmail::
|
32
|
-
RubyEmail::
|
33
|
-
RubyEmail::
|
34
|
-
RubyEmail::
|
31
|
+
RubyEmail::Rfc5322.validates? "toto@tata" # => true
|
32
|
+
RubyEmail::Rfc5322.match "toto@tata" # => #<MatchData "toto@tata" local:"toto" domain:"tata">
|
33
|
+
RubyEmail::Rfc5322.validates? "toto" # => false
|
34
|
+
RubyEmail::Rfc5322.match "toto" # => nil
|
35
35
|
|
36
36
|
# Rfc5322 + Internet basic usage
|
37
|
-
RubyEmail::
|
38
|
-
RubyEmail::
|
37
|
+
RubyEmail::Rfc5322::Public.validates? "toto@tata.com" # => true
|
38
|
+
RubyEmail::Rfc5322::Public.match "toto@tata.com" # => #<MatchData "toto@tata" local:"toto" domain:"tata.com">
|
39
39
|
|
40
40
|
# Rfc5322 Strings
|
41
41
|
require 'ruby_email/rfc5322/string'
|
@@ -54,8 +54,8 @@ require 'ruby_email/rfc5322/public/string'
|
|
54
54
|
|
55
55
|
```ruby
|
56
56
|
class Model < ActiveRecord::Base
|
57
|
-
# validates :email, format: RubyEmail::
|
58
|
-
validates :email, format: RubyEmail::
|
57
|
+
# validates :email, format: RubyEmail::Rfc5322::REGEXP # valid on an intranet ...
|
58
|
+
validates :email, format: RubyEmail::Rfc5322::Public::REGEXP
|
59
59
|
end
|
60
60
|
```
|
61
61
|
|
data/lib/ruby_email/rfc1123.rb
CHANGED
@@ -19,10 +19,10 @@ module RubyEmail
|
|
19
19
|
# a valid string with subdomains, separated by dots for domain part as IPV4
|
20
20
|
IPV4 = '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
21
21
|
# a valid string with subdomains, separated by dots for domain part as Domain Name
|
22
|
-
DOT_ATOM_TEXT = "(
|
22
|
+
DOT_ATOM_TEXT = "((#{ATOM_ALL}\\.)*#{ATOM_FIRST})"
|
23
23
|
|
24
24
|
# email grammar
|
25
|
-
VALIDE = "(?<domain>((#{DOT_ATOM_TEXT})|(#{IPV4})))"
|
25
|
+
VALIDE = "(?<domain>(?!.{254,})((#{DOT_ATOM_TEXT})|(#{IPV4})))"
|
26
26
|
|
27
27
|
# regexp to validate complete email
|
28
28
|
REGEXP = Regexp.new "\\A#{VALIDE}\\Z"
|
@@ -34,6 +34,7 @@ module RubyEmail
|
|
34
34
|
RubyEmail::Rfc1123.validates? self
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
37
38
|
end
|
38
39
|
|
39
40
|
end
|
data/lib/ruby_email/rfc5322.rb
CHANGED
data/test/rfc1123.rb
CHANGED
@@ -21,6 +21,10 @@ class TestRubyEmailRfc1123 < Test::Unit::TestCase
|
|
21
21
|
assert RubyEmail::Rfc1123.validates?("1.toto")
|
22
22
|
assert RubyEmail::Rfc1123.validates?("127.0.0.1")
|
23
23
|
assert RubyEmail::Rfc1123.validates?("255.254.251.0")
|
24
|
+
assert RubyEmail::Rfc1123.validates?("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
25
|
+
assert RubyEmail::Rfc1123.validates?("a" * 63)
|
26
|
+
assert RubyEmail::Rfc1123.validates?("a" * 63 + ".a")
|
27
|
+
assert RubyEmail::Rfc1123.validates?("aaa" + ".a"*125)
|
24
28
|
end
|
25
29
|
|
26
30
|
def test_plus_false
|
@@ -41,6 +45,8 @@ class TestRubyEmailRfc1123 < Test::Unit::TestCase
|
|
41
45
|
assert !RubyEmail::Rfc1123.validates?("111")
|
42
46
|
assert !RubyEmail::Rfc1123.validates?("a.1")
|
43
47
|
assert !RubyEmail::Rfc1123.validates?("1.1")
|
48
|
+
assert !RubyEmail::Rfc1123.validates?("a" * 64)
|
49
|
+
assert !RubyEmail::Rfc1123.validates?("aaaa" + ".a"*125)
|
44
50
|
end
|
45
51
|
|
46
52
|
def test_match
|
@@ -65,20 +71,3 @@ class TestRubyEmailRfc1123 < Test::Unit::TestCase
|
|
65
71
|
end
|
66
72
|
|
67
73
|
end
|
68
|
-
|
69
|
-
class TestRubyEmailRfc1123Public < Test::Unit::TestCase
|
70
|
-
def test_simpe
|
71
|
-
assert RubyEmail::Rfc1123::Public.validates?("toto.toto")
|
72
|
-
assert RubyEmail::Rfc1123::Public.validates?("toto.toto.toto")
|
73
|
-
assert RubyEmail::Rfc1123::Public.validates?("toto.toto.toto.toto")
|
74
|
-
assert !RubyEmail::Rfc1123::Public.validates?("toto")
|
75
|
-
assert RubyEmail::Rfc1123::Public.match("toto.toto")
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_string
|
79
|
-
assert_raise { "toto.toto".is_public_domain? }
|
80
|
-
require_relative '../lib/ruby_email/rfc1123/public/string'
|
81
|
-
assert "toto.toto".is_public_domain?
|
82
|
-
assert !"toto".is_public_domain?
|
83
|
-
end
|
84
|
-
end
|
data/test/rfc5322.rb
CHANGED
@@ -60,20 +60,3 @@ class TestRubyEmailRfc5322 < Test::Unit::TestCase
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
|
-
|
64
|
-
class TestRubyEmailRfc5322Public < Test::Unit::TestCase
|
65
|
-
def test_simpe
|
66
|
-
assert RubyEmail::Rfc5322::Public.validates?("toto@toto.toto")
|
67
|
-
assert RubyEmail::Rfc5322::Public.validates?("toto@toto.toto.toto")
|
68
|
-
assert RubyEmail::Rfc5322::Public.validates?("toto@toto.toto.toto.toto")
|
69
|
-
assert !RubyEmail::Rfc5322::Public.validates?("toto@toto")
|
70
|
-
assert RubyEmail::Rfc5322::Public.match("toto@toto.toto")
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_string
|
74
|
-
assert_raise { "toto@toto.toto".is_public_email? }
|
75
|
-
require_relative '../lib/ruby_email/rfc5322/public/string'
|
76
|
-
assert "toto@toto.toto".is_public_email?
|
77
|
-
assert !"toto@toto".is_public_email?
|
78
|
-
end
|
79
|
-
end
|
data/test/unit_test.rb
CHANGED
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data.tar.gz.sig
CHANGED
Binary file
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nephos (poulet_a)
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
tcYkgfqUJPitIJx1RvWZpIyH5uJhRUYK3+vU9nMOxez5WbIlC1TtpByKAPMX+sht
|
32
32
|
gib3AoIT8jh/2w==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-05-
|
34
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: nomorebeer
|
metadata.gz.sig
CHANGED
Binary file
|