naughty_or_nice 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/naughty_or_nice.rb +9 -7
- data/lib/naughty_or_nice/version.rb +3 -1
- metadata +38 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76bf0044478e435776c91bdb769f30517f71832a44d6c5091ac9ef5b4f76823c
|
4
|
+
data.tar.gz: a426c8e77324a8fd72e652c2f9fc0ace6b35e3bc60d901edd049c241c150f226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e4e117e1b6cf2a0825ef65c11807b1e238b02894ab8a6f07065bc2dc7410a863cb7b10021702cec8ed33f644db0ebce89997a773036573af33c8ee7e052216
|
7
|
+
data.tar.gz: 4ed85b6546a1d2520759a2d5e4c35f7de6e4fc2c448dbf452cb1ade23d6ca2491c809908cb00ec5866b2cbd9bd5e88ab1679dadbb4faea78290e75ace8968759
|
data/lib/naughty_or_nice.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'public_suffix'
|
2
4
|
require 'addressable/uri'
|
3
5
|
require_relative './naughty_or_nice/version'
|
@@ -8,11 +10,11 @@ module NaughtyOrNice
|
|
8
10
|
EMAIL_REGEX = %r{
|
9
11
|
^
|
10
12
|
(
|
11
|
-
[\w
|
13
|
+
[\w!\#$%&'*+\-/=?\^`\{|\}~]+
|
12
14
|
\.
|
13
15
|
)
|
14
16
|
*
|
15
|
-
[\w
|
17
|
+
[\w!\#$%&'*+\-/=?\^`\{|\}~]+
|
16
18
|
@
|
17
19
|
(
|
18
20
|
(
|
@@ -37,7 +39,7 @@ module NaughtyOrNice
|
|
37
39
|
){3}
|
38
40
|
\d{1,3}
|
39
41
|
(
|
40
|
-
|
42
|
+
:\d{1,5}
|
41
43
|
)?
|
42
44
|
)
|
43
45
|
$
|
@@ -73,8 +75,8 @@ module NaughtyOrNice
|
|
73
75
|
|
74
76
|
@domain = begin
|
75
77
|
PublicSuffix.parse(normalized_domain, default_rule: nil)
|
76
|
-
|
77
|
-
|
78
|
+
rescue PublicSuffix::DomainInvalid, PublicSuffix::DomainNotAllowed
|
79
|
+
nil
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -119,8 +121,8 @@ module NaughtyOrNice
|
|
119
121
|
def parsed_domain
|
120
122
|
@parsed_domain ||= begin
|
121
123
|
text = @text.dup
|
122
|
-
text
|
123
|
-
uri
|
124
|
+
text.prepend('http://') unless %r{\Ahttps?://}.match?(text)
|
125
|
+
uri = Addressable::URI.parse(text)
|
124
126
|
# properly parse http://foo edge cases
|
125
127
|
# see https://github.com/sporkmonger/addressable/issues/145
|
126
128
|
uri if uri.host.include?('.')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naughty_or_nice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -30,20 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '4.0'
|
33
|
+
version: '3.0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '4.0'
|
40
|
+
version: '3.0'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: pry
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +72,42 @@ dependencies:
|
|
78
72
|
requirements:
|
79
73
|
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
|
-
version: '0
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-performance
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.5'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.0'
|
82
104
|
type: :development
|
83
105
|
prerelease: false
|
84
106
|
version_requirements: !ruby/object:Gem::Requirement
|
85
107
|
requirements:
|
86
108
|
- - "~>"
|
87
109
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
110
|
+
version: '2.0'
|
89
111
|
description: Naughty or Nice simplifies the process of extracting domain information
|
90
112
|
from a domain-like string (an email, a URL, etc.) and checking whether it meets
|
91
113
|
criteria you specify.
|
@@ -102,7 +124,7 @@ homepage: http://github.com/benbalter/naughty_or_nice
|
|
102
124
|
licenses:
|
103
125
|
- MIT
|
104
126
|
metadata: {}
|
105
|
-
post_install_message:
|
127
|
+
post_install_message:
|
106
128
|
rdoc_options: []
|
107
129
|
require_paths:
|
108
130
|
- lib
|
@@ -117,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
139
|
- !ruby/object:Gem::Version
|
118
140
|
version: '0'
|
119
141
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
142
|
+
rubygems_version: 3.1.4
|
143
|
+
signing_key:
|
122
144
|
specification_version: 4
|
123
145
|
summary: You've made the list. We'll help you check it twice. Given a domain-like
|
124
146
|
string, verifies inclusion in a list you provide.
|