public-suffix-list 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +5 -0
- data/README.rdoc +3 -3
- data/lib/public_suffix_list.rb +4 -4
- data/spec/caching.spec +1 -1
- data/spec/cookie_calculation.spec +1 -1
- data/spec/public_suffix_list.spec +1 -1
- data/spec/rdoc_synopsis.spec +18 -0
- data/spec/upcase_downcase.spec +18 -0
- metadata +33 -35
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NGNlNjRmN2E2YWNjNmEyNTQyMjRjMDM5Y2QyNTZhODBhZTgwM2RmOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjU0ZTEzNTVlYjM4ZDI4N2Q0NzdiZjdhYWFmOThiMDczNmI2YWE0Yw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2MyZDMwYzBlNTNhZDFjZjFkNWY2ODg4Y2FiNzg0MzMwMDQxM2IyOTVjZDE1
|
10
|
+
MDg2MWVkZmRlZjM1ZmIxNTY4ZDY0YThkOGY0NDQwYmQzMDMyMDY0YmQ3YTJi
|
11
|
+
ZTYxOGY0ODBlZWRjNDQ2NzljMWE3ZGY3MzNlOWU4Yjk3YWE4ZjI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzI2MmQxZWJiZTkxZDk0M2ZhZmNlMGNiMTViMjczNDg0OTJkNGQxM2UzOWZl
|
14
|
+
ZmNhOGJjZTc1NWExZTNiMTFhZTEwMTgxZGEwZTNmNTAyYmRkMjQ0MzExZjIx
|
15
|
+
ZTdiODRlYTIyZjMxMjBiNGYxODAyMTdiNzdhMDA5OGI3ZWZlMjI=
|
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -45,8 +45,8 @@ are three instance methods:
|
|
45
45
|
|
46
46
|
# Loads the cached data in /tmp if it is less than 100 seconds old,
|
47
47
|
# downloads, parses, and caches it if it is older, and returns
|
48
|
-
# ["test", "
|
49
|
-
PublicSuffixList.new(:cache_dir => "/tmp", :cache_expiry_period => 100).split("test.
|
48
|
+
# ["test", "parliament", "uk"].
|
49
|
+
PublicSuffixList.new(:cache_dir => "/tmp", :cache_expiry_period => 100).split("test.parliament.uk")
|
50
50
|
|
51
51
|
# You don't have to instantiate PublicSuffixList every time you
|
52
52
|
# use it, of course...
|
@@ -69,7 +69,7 @@ None that I am aware of.
|
|
69
69
|
|
70
70
|
== License
|
71
71
|
|
72
|
-
Copyright (c) 2010 Todd Sundsted
|
72
|
+
Copyright (c) 2010, 2011, 2012, 2013, 2014 Todd Sundsted
|
73
73
|
|
74
74
|
Permission is hereby granted, free of charge, to any person obtaining
|
75
75
|
a copy of this software and associated documentation files (the
|
data/lib/public_suffix_list.rb
CHANGED
@@ -6,7 +6,7 @@ require "public_suffix_list/parser.rb"
|
|
6
6
|
|
7
7
|
class PublicSuffixList
|
8
8
|
|
9
|
-
VERSION = "0.1.
|
9
|
+
VERSION = "0.1.2"
|
10
10
|
|
11
11
|
def self.config
|
12
12
|
@@config ||= Config.new
|
@@ -29,7 +29,7 @@ class PublicSuffixList
|
|
29
29
|
def initialize
|
30
30
|
@cache_dir = nil
|
31
31
|
@cache_expiry_period = 30 * 24 * 60 * 60
|
32
|
-
@url = "http://
|
32
|
+
@url = "http://publicsuffix.org/list/effective_tld_names.dat"
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
@@ -80,7 +80,7 @@ class PublicSuffixList
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def cache
|
83
|
-
@cache_file[:rules] = rules
|
83
|
+
@cache_file[:rules] = @rules
|
84
84
|
end
|
85
85
|
|
86
86
|
def uncache
|
@@ -92,7 +92,7 @@ class PublicSuffixList
|
|
92
92
|
domain = domain.dup
|
93
93
|
first = domain.pop
|
94
94
|
set = []
|
95
|
-
[[first, first], ["!#{first}", "!#{first}"], ["*", first]].each do |pattern, name|
|
95
|
+
[[first.downcase, first], ["!#{first.downcase}", "!#{first}"], ["*", first]].each do |pattern, name|
|
96
96
|
if rules[pattern]
|
97
97
|
set << [name] if rules[pattern][:term]
|
98
98
|
match(domain, rules[pattern]).each { |result| set << [first] + result }
|
data/spec/caching.spec
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'public_suffix_list'
|
3
|
+
|
4
|
+
describe PublicSuffixList do
|
5
|
+
|
6
|
+
it "should handle the cases in the rdoc synopsis" do
|
7
|
+
PublicSuffixList.new.tld("foobar.com").should == "com"
|
8
|
+
PublicSuffixList.new.cdn("foobar.com").should == "foobar.com"
|
9
|
+
PublicSuffixList.new(:cache_dir => "/tmp").split("abc.xyz.co.uk").should == ["abc", "xyz", "co.uk"]
|
10
|
+
PublicSuffixList.new(:cache_dir => "/tmp", :cache_expiry_period => 100).split("test.parliament.uk").should == ["test", "parliament", "uk"]
|
11
|
+
p = PublicSuffixList.new
|
12
|
+
p.split("fee.fi.fo.com").should == ["fee.fi", "fo", "com"]
|
13
|
+
p.cdn("fee.fi.fo.com").should == "fo.com"
|
14
|
+
p.tld("fee.fi.fo.com").should == "com"
|
15
|
+
PublicSuffixList.new(:url => "spec/test.dat")
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'public_suffix_list'
|
2
|
+
|
3
|
+
describe PublicSuffixList do
|
4
|
+
|
5
|
+
it "should be case insensitive" do
|
6
|
+
p = PublicSuffixList.new
|
7
|
+
p.split("fee.fi.fo.com").should == ["fee.fi", "fo", "com"]
|
8
|
+
p.cdn("fee.fi.fo.com").should == "fo.com"
|
9
|
+
p.tld("fee.fi.fo.com").should == "com"
|
10
|
+
p.split("FEE.FI.FO.COM").should == ["FEE.FI", "FO", "COM"]
|
11
|
+
p.cdn("FEE.FI.FO.COM").should == "FO.COM"
|
12
|
+
p.tld("FEE.FI.FO.COM").should == "COM"
|
13
|
+
p.split("Fee.Fi.Fo.Com").should == ["Fee.Fi", "Fo", "Com"]
|
14
|
+
p.cdn("Fee.Fi.Fo.Com").should == "Fo.Com"
|
15
|
+
p.tld("Fee.Fi.Fo.Com").should == "Com"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,62 +1,60 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: public-suffix-list
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- Todd Sundsted
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2010-01-15 00:00:00 -05:00
|
13
|
-
default_executable:
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
14
12
|
dependencies: []
|
15
|
-
|
16
|
-
|
13
|
+
description: The Public Suffix List (http://publicsuffix.org/) is "a cross-vendor
|
14
|
+
initiative to provide an accurate list of domain name suffixes". Such a list is
|
15
|
+
necessary because "there was and remains no algorithmic method of finding the highest
|
16
|
+
level at which a domain may be registered for a particular top-level domain (the
|
17
|
+
policies differ with each registry)...". Public Suffix List is also a small Ruby
|
18
|
+
library designed to make the Public Suffix List (http://publicsuffix.org/) easier
|
19
|
+
to use.
|
17
20
|
email:
|
18
21
|
executables: []
|
19
|
-
|
20
22
|
extensions: []
|
21
|
-
|
22
23
|
extra_rdoc_files: []
|
23
|
-
|
24
|
-
|
24
|
+
files:
|
25
|
+
- Gemfile
|
25
26
|
- README.rdoc
|
26
27
|
- lib/public_suffix_list.rb
|
27
|
-
- lib/public_suffix_list/parser.rb
|
28
28
|
- lib/public_suffix_list/cache_file.rb
|
29
|
+
- lib/public_suffix_list/parser.rb
|
29
30
|
- spec/caching.spec
|
30
31
|
- spec/cookie_calculation.spec
|
31
32
|
- spec/public_suffix_list.spec
|
33
|
+
- spec/rdoc_synopsis.spec
|
34
|
+
- spec/upcase_downcase.spec
|
32
35
|
- spec/test.dat
|
33
|
-
has_rdoc: true
|
34
36
|
homepage: http://github.com/toddsundsted/Public-Suffix-List
|
35
37
|
licenses: []
|
36
|
-
|
38
|
+
metadata: {}
|
37
39
|
post_install_message:
|
38
40
|
rdoc_options: []
|
39
|
-
|
40
|
-
require_paths:
|
41
|
+
require_paths:
|
41
42
|
- lib
|
42
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
version: "0"
|
53
|
-
version:
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
54
53
|
requirements: []
|
55
|
-
|
56
54
|
rubyforge_project:
|
57
|
-
rubygems_version: 1.
|
55
|
+
rubygems_version: 2.1.11
|
58
56
|
signing_key:
|
59
|
-
specification_version:
|
60
|
-
summary: Public Suffix List is a small Ruby library designed to make the Public Suffix
|
57
|
+
specification_version: 4
|
58
|
+
summary: Public Suffix List is a small Ruby library designed to make the Public Suffix
|
59
|
+
List (http://publicsuffix.org/) easier to use.
|
61
60
|
test_files: []
|
62
|
-
|