gman 8.1.0 → 8.2.0
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
- data/lib/gman/locality.rb +4 -1
- data/lib/gman/version.rb +1 -1
- data/lib/gman.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79ceaf4838ca91d410793c34d49b5fbc5e3ce83a28e50620a5e21df95d47544b
|
|
4
|
+
data.tar.gz: e9bbc0393a6b26b98adfba86970d4e55a51404cad10fcdd15d267e5f2ae30974
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 255989a15642e7626fa7e7e55086686b69ae3ee3e42188f894ecbaf48ed9a2a24d4457945aa64a5fe4783d693ff39c907e6de25bc052198a89d430a9869141a5
|
|
7
|
+
data.tar.gz: 79af4a684fd94d5aa626271d67fba5b79ce59f522ab287f28e32050a3a9d0919c4c6131e3ab0a6f34cc12093a96deb0afa28296084639138881a87183b8ad1d8
|
data/lib/gman/locality.rb
CHANGED
|
@@ -27,12 +27,15 @@ class Gman
|
|
|
27
27
|
parish town twp vi vil village
|
|
28
28
|
].freeze
|
|
29
29
|
|
|
30
|
+
# Anchored so the locality must be the end of the hostname and start at a
|
|
31
|
+
# label boundary (e.g. not state.il.us.example.com or state.ca.usexample.com)
|
|
30
32
|
REGEX = /
|
|
33
|
+
(?:\A|\.)
|
|
31
34
|
(
|
|
32
35
|
(#{Regexp.union(AFFINITY_NAMESPACES)})
|
|
33
36
|
|
|
|
34
37
|
(#{Regexp.union(LOCALITY_DOMAINS)})\.[a-z-]+
|
|
35
|
-
)\.(#{Regexp.union(STATES)})\.us
|
|
38
|
+
)\.(#{Regexp.union(STATES)})\.us\z
|
|
36
39
|
/x
|
|
37
40
|
|
|
38
41
|
def self.valid?(domain)
|
data/lib/gman/version.rb
CHANGED
data/lib/gman.rb
CHANGED
|
@@ -54,6 +54,24 @@ class Gman
|
|
|
54
54
|
|
|
55
55
|
private
|
|
56
56
|
|
|
57
|
+
# Overrides NaughtyOrNice#normalized_domain, which parses every input as a
|
|
58
|
+
# URL. For an email address, the URL host can differ from the domain mail is
|
|
59
|
+
# delivered to (e.g. "x@gsa.gov#"@example.com), so the domain after the last
|
|
60
|
+
# @ must be the same host the URL parser sees.
|
|
61
|
+
#
|
|
62
|
+
# Returns the domain string, or nil
|
|
63
|
+
def normalized_domain
|
|
64
|
+
return if @text.match?(/[[:space:][:cntrl:]]/)
|
|
65
|
+
return super unless email_like?
|
|
66
|
+
|
|
67
|
+
host = @text.rpartition('@').last
|
|
68
|
+
host if host == super
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def email_like?
|
|
72
|
+
@text.include?('@') && !%r{\Ahttps?://}.match?(@text)
|
|
73
|
+
end
|
|
74
|
+
|
|
57
75
|
def valid_domain?
|
|
58
76
|
!domain.nil? && !academic?
|
|
59
77
|
end
|