naughty_or_nice 0.0.3 → 0.0.4
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/naughty_or_nice.rb +6 -8
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d85f51a7bb462630a5fa8145a88ebff5e51aed7
|
|
4
|
+
data.tar.gz: 67c413c0373ed0dd8516c33f07c0852dca6e79a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8a2b4b6a128bc0cbd5194281552941e17948f9db74e42081c26729b1d56d05cf61d1a3f55bc5de348868755e711361241df4f83d66634419522795ed9fa377d
|
|
7
|
+
data.tar.gz: a19f454d60ca1406921622c01ce20b45cb292f567530e320a8317b1a6f66c1d64015e09380b2f3e30a52477bff14a28d3bf3894028fd24ae1a5f5c9e09f2f6dc
|
data/lib/naughty_or_nice.rb
CHANGED
|
@@ -68,15 +68,13 @@ class NaughtyOrNice
|
|
|
68
68
|
elsif email?
|
|
69
69
|
@text.match(/@([\w\.\-]+)\Z/i)[1]
|
|
70
70
|
else # url sans http://
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
uri.host if uri.host =~ /\./
|
|
76
|
-
rescue Addressable::URI::InvalidURIError
|
|
77
|
-
nil
|
|
78
|
-
end
|
|
71
|
+
uri = Addressable::URI.parse("http://#{@text}")
|
|
72
|
+
# properly parse http://foo edge cases
|
|
73
|
+
# see https://github.com/sporkmonger/addressable/issues/145
|
|
74
|
+
uri.host if uri.host =~ /\./
|
|
79
75
|
end
|
|
76
|
+
rescue Addressable::URI::InvalidURIError
|
|
77
|
+
nil
|
|
80
78
|
end
|
|
81
79
|
end
|
|
82
80
|
alias_method :to_s, :domain
|
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: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Balter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: public_suffix
|
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
112
|
version: '0'
|
|
113
113
|
requirements: []
|
|
114
114
|
rubyforge_project:
|
|
115
|
-
rubygems_version: 2.2.
|
|
115
|
+
rubygems_version: 2.2.3
|
|
116
116
|
signing_key:
|
|
117
117
|
specification_version: 4
|
|
118
118
|
summary: You've made the list. We'll help you check it twice. Given a domain-like
|