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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56b3fbe678e72450decc15bfc4d04a35b92765c5f89047d6c409a90df290ba07
4
- data.tar.gz: d9ee244d9c2741445492ce2a1abbbb8fdf9e09182850ea0788c167a14f3b843a
3
+ metadata.gz: 54b6ee13b43095bfd9faeff145f55a40efb64afbab15aed310cae7b7fa2da075
4
+ data.tar.gz: 6f9c77c0eea29b1390b285b0a88dd47a25e630610f871d2c700c38d6a9bad5ac
5
5
  SHA512:
6
- metadata.gz: dd61d9cf052e21c113d337f4baa192d6397fb27ea1db83edd353166dd0bcc277acde381a31e177f1f2de732d2a1f1eea646d3ddd562d1aa6300c453c7a06ac26
7
- data.tar.gz: 41517c82d6996b6f68bcb1491d4232aa24d95c2fd6f405996e4e75270e927fd14399a51e81cad6d679afd808124f07be9114c6b6a986c269405d0d64e14d7d11
6
+ metadata.gz: ef0b78aed3f05314133aefaeac21dd1f4a9704d9d3415270d2a63047b5523dbf6784f4d7de3f6484e6bbfe53f041c2526f75eb73827de53401fb0daf092121c0
7
+ data.tar.gz: 20690c9360ba3bf1ee04556e3d8e14748e4e7bac7b86e34c982b4571f5d3f346d9a67d032bd74335e6e32d40fa020f9b3de16577753a5d03127c18239c5fc598
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- adomain (0.2.1)
4
+ adomain (0.2.2)
5
5
  addressable (~> 2.5)
6
6
  logger
7
7
 
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 is only included for convenience
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
- Addressable::URI.parse(string).path
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
@@ -1,3 +1,3 @@
1
1
  class Adomain
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adomain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Nissen