domo-rb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -4
- data/lib/domo.rb +2 -2
- data/lib/domo/version.rb +1 -1
- data/spec/domo_spec.rb +8 -8
- metadata +27 -36
data/README.md
CHANGED
@@ -2,20 +2,20 @@
|
|
2
2
|
Utility functions for domain strings
|
3
3
|
|
4
4
|
### Installation
|
5
|
-
gem install domo
|
5
|
+
gem install domo-rb
|
6
6
|
|
7
7
|
|
8
8
|
### Usage
|
9
9
|
>> require 'domo'
|
10
10
|
=> 'true'
|
11
11
|
|
12
|
-
>> Domo.
|
12
|
+
>> Domo.canonicalize "www.ebay.com"
|
13
13
|
=> "ebay.com"
|
14
14
|
|
15
|
-
>> Domo.
|
15
|
+
>> Domo.canonicalize "boats.ebay.co.uk"
|
16
16
|
=> "ebay.co.uk"
|
17
17
|
|
18
|
-
>> Domo.
|
18
|
+
>> Domo.canonicalize "edition.cnn.com"
|
19
19
|
=> "cnn.com"
|
20
20
|
|
21
21
|
>> Domo.strip_url "http://www.cnn.com/news/last-week/main.html"
|
data/lib/domo.rb
CHANGED
@@ -8,12 +8,12 @@ module Domo
|
|
8
8
|
|
9
9
|
REGEX = /^(#{GENERIC_TOP_LEVEL_DOMAINS.join("|")}|#{GEO_TOP_LEVEL_DOMAINS.join("|")})$/
|
10
10
|
|
11
|
-
# Returns a
|
11
|
+
# Returns a canonicalized domain for a given domain string
|
12
12
|
# Examples:
|
13
13
|
# "www.cnn.com" => "cnn.com"
|
14
14
|
# "books.ebay.co.uk" => "ebay.co.uk"
|
15
15
|
# "news.nytimes.com:3000" => "nytimes.com"
|
16
|
-
def self.
|
16
|
+
def self.canonicalize(domain)
|
17
17
|
parts = domain.split(":")[0].split(".").reverse
|
18
18
|
|
19
19
|
check_further = true
|
data/lib/domo/version.rb
CHANGED
data/spec/domo_spec.rb
CHANGED
@@ -2,20 +2,20 @@ require File.join(File.dirname(__FILE__),"spec_helper")
|
|
2
2
|
|
3
3
|
describe "Domo" do
|
4
4
|
|
5
|
-
it "should
|
6
|
-
Domo.
|
5
|
+
it "should canonicalize 'www.ebay.com'" do
|
6
|
+
Domo.canonicalize("www.ebay.com").should == "ebay.com"
|
7
7
|
end
|
8
8
|
|
9
|
-
it "should
|
10
|
-
Domo.
|
9
|
+
it "should canonicalize 'motors.ebay.com'" do
|
10
|
+
Domo.canonicalize("motors.ebay.com").should == "ebay.com"
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should
|
14
|
-
Domo.
|
13
|
+
it "should canonicalize 'www.ebay.co.uk'" do
|
14
|
+
Domo.canonicalize("www.ebay.co.uk").should == "ebay.co.uk"
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should
|
18
|
-
Domo.
|
17
|
+
it "should canonicalize 'ebay.com'" do
|
18
|
+
Domo.canonicalize("ebay.com").should == "ebay.com"
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should strip 'http://www.ebay.com/shopping/1.html'" do
|
metadata
CHANGED
@@ -1,38 +1,34 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: domo-rb
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Gur Dotan
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-12-05 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rspec
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &14943980 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
25
22
|
type: :development
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *14943980
|
27
25
|
description:
|
28
26
|
email: gurdotan@gmail.com
|
29
27
|
executables: []
|
30
|
-
|
31
28
|
extensions: []
|
32
|
-
|
33
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
34
30
|
- README.md
|
35
|
-
files:
|
31
|
+
files:
|
36
32
|
- .gitignore
|
37
33
|
- .rvmrc
|
38
34
|
- Gemfile
|
@@ -43,33 +39,28 @@ files:
|
|
43
39
|
- lib/domo/version.rb
|
44
40
|
- spec/domo_spec.rb
|
45
41
|
- spec/spec_helper.rb
|
46
|
-
has_rdoc: true
|
47
42
|
homepage: http://github.com/gurdotan/domo.rb
|
48
43
|
licenses: []
|
49
|
-
|
50
44
|
post_install_message:
|
51
45
|
rdoc_options: []
|
52
|
-
|
53
|
-
require_paths:
|
46
|
+
require_paths:
|
54
47
|
- - lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
49
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
55
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
66
59
|
version: 1.3.6
|
67
60
|
requirements: []
|
68
|
-
|
69
61
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.8.10
|
71
63
|
signing_key:
|
72
64
|
specification_version: 3
|
73
65
|
summary: Utility functions for domain strings
|
74
66
|
test_files: []
|
75
|
-
|