adomain 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/adomain.rb +9 -2
- data/lib/adomain/version.rb +1 -1
- 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: 54b6ee13b43095bfd9faeff145f55a40efb64afbab15aed310cae7b7fa2da075
|
4
|
+
data.tar.gz: 6f9c77c0eea29b1390b285b0a88dd47a25e630610f871d2c700c38d6a9bad5ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0b78aed3f05314133aefaeac21dd1f4a9704d9d3415270d2a63047b5523dbf6784f4d7de3f6484e6bbfe53f041c2526f75eb73827de53401fb0daf092121c0
|
7
|
+
data.tar.gz: 20690c9360ba3bf1ee04556e3d8e14748e4e7bac7b86e34c982b4571f5d3f346d9a67d032bd74335e6e32d40fa020f9b3de16577753a5d03127c18239c5fc598
|
data/Gemfile.lock
CHANGED
data/lib/adomain.rb
CHANGED
@@ -50,9 +50,16 @@ class Adomain
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# path is a wrapper around Addressable::URI's path
|
53
|
-
# it
|
53
|
+
# with a major difference -- it removes the domain components
|
54
|
+
# from the string, if the domain is parseable. This is because
|
55
|
+
# Addressable leaves it in, for reasons I can't understand.
|
54
56
|
def path(string)
|
55
|
-
|
57
|
+
if self.subdomain_www(string)
|
58
|
+
substring = /\A#{Regexp.quote(self.subdomain_www(string))}/
|
59
|
+
Addressable::URI.parse(string).path.gsub(substring, '')
|
60
|
+
else
|
61
|
+
Addressable::URI.parse(string).path
|
62
|
+
end
|
56
63
|
rescue Addressable::URI::InvalidURIError => e
|
57
64
|
nil
|
58
65
|
end
|
data/lib/adomain/version.rb
CHANGED