rippersnapper 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/README.md +4 -1
- data/lib/rippersnapper.rb +1 -0
- data/lib/rippersnapper/ip_parser.rb +23 -0
- data/lib/rippersnapper/url.rb +7 -1
- data/lib/rippersnapper/version.rb +1 -1
- data/spec/rippersnapper/url_spec.rb +11 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7202bdd1f9dc7fa438a08db2f2a6e09482033ee5
|
4
|
+
data.tar.gz: 287f5995cb970c67673b50ac2982215ea8fe6515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1861dada6eb732b7b5bf1eeee82e83bc1168ef06385ffa9c3aa619d645b6eee6a5d975519d6273fefd5c3db75da284d3085551d619cda24f43f7289dc295d3ba
|
7
|
+
data.tar.gz: a7d4a01f0ea5e3319a6517a432d86d460b7aa8348dc4b35eb963aec412f661cb661d893095bb5ee0f64e08d2cdcc233439ab81f80c33bc81840dd8f328f38f5c
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Rippersnapper
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/mwoods79/rippersnapper.svg?branch=master)](https://travis-ci.org/mwoods79/rippersnapper)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/mwoods79/rippersnapper.png)](https://codeclimate.com/github/mwoods79/rippersnapper)
|
5
|
+
|
3
6
|
![Rippersnapper](https://github.com/mwoods79/rippersnapper/raw/master/rippersnapper.jpg)
|
4
7
|
|
5
8
|
Rippersnapper transforms into a weird upright bipedal shark creature. His finned
|
@@ -35,7 +38,7 @@ Or install it yourself as:
|
|
35
38
|
|
36
39
|
## Notable differences between Rippersnapper and [Domainatrix](https://github.com/pauldix/domainatrix)
|
37
40
|
|
38
|
-
One of Rippersnappers goals is to be a
|
41
|
+
One of Rippersnappers goals is to be a compatible API with Domainatrix, but
|
39
42
|
there are some differences.
|
40
43
|
|
41
44
|
1. Rippersnapper chose the method name `suffix` instead of `public_suffix`.
|
data/lib/rippersnapper.rb
CHANGED
data/lib/rippersnapper/url.rb
CHANGED
@@ -20,6 +20,12 @@ module Rippersnapper
|
|
20
20
|
@uri ||= URI.parse url
|
21
21
|
end
|
22
22
|
|
23
|
+
# Used to see if the host is an IP address
|
24
|
+
# @return [Boolean] true represents an ip address for host
|
25
|
+
def ip?
|
26
|
+
!!(host =~ /^\d+\.\d+\.\d+\.\d+$/)
|
27
|
+
end
|
28
|
+
|
23
29
|
# If url has a scheme use it if not assume http
|
24
30
|
# @return [String] The url to be processed
|
25
31
|
def url
|
@@ -84,7 +90,7 @@ module Rippersnapper
|
|
84
90
|
private
|
85
91
|
|
86
92
|
def parsed_domain
|
87
|
-
@parsed_domain ||= DomainParser.new
|
93
|
+
@parsed_domain ||= ip? ? IpParser.new(host) : DomainParser.new(host)
|
88
94
|
end
|
89
95
|
end
|
90
96
|
end
|
@@ -56,5 +56,16 @@ module Rippersnapper
|
|
56
56
|
its(:subdomain) { should eq "" }
|
57
57
|
its(:port) { should be_nil }
|
58
58
|
end
|
59
|
+
|
60
|
+
context "whith ip address" do
|
61
|
+
subject { Url.new "http://10.0.1.1/" }
|
62
|
+
its(:url) { should eq "http://10.0.1.1/" }
|
63
|
+
its(:path) { should eq "/" }
|
64
|
+
its(:scheme) { should eq "http" }
|
65
|
+
its(:host) { should eq "10.0.1.1" }
|
66
|
+
its(:suffix) { should eq "" }
|
67
|
+
its(:domain) { should eq "10.0.1.1" }
|
68
|
+
its(:subdomain) { should eq "" }
|
69
|
+
end
|
59
70
|
end
|
60
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rippersnapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,12 +61,14 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
|
+
- ".travis.yml"
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
68
69
|
- lib/rippersnapper.rb
|
69
70
|
- lib/rippersnapper/domain_parser.rb
|
71
|
+
- lib/rippersnapper/ip_parser.rb
|
70
72
|
- lib/rippersnapper/public_suffix.dat
|
71
73
|
- lib/rippersnapper/suffix_file_reader.rb
|
72
74
|
- lib/rippersnapper/url.rb
|