public_suffix 4.0.6 → 4.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -63,7 +63,7 @@ module PublicSuffix
63
63
  #
64
64
  # See http://publicsuffix.org/format/ for more details about input format.
65
65
  #
66
- # @param string [#each_line] the list to parse
66
+ # @param input [#each_line] the list to parse
67
67
  # @param private_domains [Boolean] whether to ignore the private domains section
68
68
  # @return [PublicSuffix::List]
69
69
  def self.parse(input, private_domains: true)
@@ -173,7 +173,7 @@ module PublicSuffix
173
173
  # @return [PublicSuffix::Rule::*]
174
174
  def find(name, default: default_rule, **options)
175
175
  rule = select(name, **options).inject do |l, r|
176
- return r if r.class == Rule::Exception
176
+ return r if r.instance_of?(Rule::Exception)
177
177
 
178
178
  l.length > r.length ? l : r
179
179
  end
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -131,10 +131,9 @@ module PublicSuffix
131
131
 
132
132
  # Checks whether this rule is equal to <tt>other</tt>.
133
133
  #
134
- # @param [PublicSuffix::Rule::*] other The rule to compare
135
- # @return [Boolean]
136
- # Returns true if this rule and other are instances of the same class
137
- # and has the same value, false otherwise.
134
+ # @param other [PublicSuffix::Rule::*] The rule to compare
135
+ # @return [Boolean] true if this rule and other are instances of the same class
136
+ # and has the same value, false otherwise.
138
137
  def ==(other)
139
138
  equal?(other) || (self.class == other.class && value == other.value)
140
139
  end
@@ -176,7 +175,7 @@ module PublicSuffix
176
175
  end
177
176
 
178
177
  # @abstract
179
- # @param [String, #to_s] name The domain name to decompose
178
+ # @param domain [#to_s] The domain name to decompose
180
179
  # @return [Array<String, nil>]
181
180
  def decompose(*)
182
181
  raise NotImplementedError
@@ -196,7 +195,7 @@ module PublicSuffix
196
195
 
197
196
  # Decomposes the domain name according to rule properties.
198
197
  #
199
- # @param [String, #to_s] name The domain name to decompose
198
+ # @param domain [#to_s] The domain name to decompose
200
199
  # @return [Array<String>] The array with [trd + sld, tld].
201
200
  def decompose(domain)
202
201
  suffix = parts.join('\.')
@@ -228,6 +227,7 @@ module PublicSuffix
228
227
  # Initializes a new rule.
229
228
  #
230
229
  # @param value [String]
230
+ # @param length [Integer]
231
231
  # @param private [Boolean]
232
232
  def initialize(value:, length: nil, private: false)
233
233
  super(value: value, length: length, private: private)
@@ -243,7 +243,7 @@ module PublicSuffix
243
243
 
244
244
  # Decomposes the domain name according to rule properties.
245
245
  #
246
- # @param [String, #to_s] name The domain name to decompose
246
+ # @param domain [#to_s] The domain name to decompose
247
247
  # @return [Array<String>] The array with [trd + sld, tld].
248
248
  def decompose(domain)
249
249
  suffix = ([".*?"] + parts).join('\.')
@@ -266,7 +266,7 @@ module PublicSuffix
266
266
 
267
267
  # Initializes a new rule from the content.
268
268
  #
269
- # @param content [String] the content of the rule
269
+ # @param content [#to_s] the content of the rule
270
270
  # @param private [Boolean]
271
271
  def self.build(content, private: false)
272
272
  new(value: content.to_s[1..-1], private: private)
@@ -281,7 +281,7 @@ module PublicSuffix
281
281
 
282
282
  # Decomposes the domain name according to rule properties.
283
283
  #
284
- # @param [String, #to_s] name The domain name to decompose
284
+ # @param domain [#to_s] The domain name to decompose
285
285
  # @return [Array<String>] The array with [trd + sld, tld].
286
286
  def decompose(domain)
287
287
  suffix = parts.join('\.')
@@ -321,7 +321,7 @@ module PublicSuffix
321
321
  # PublicSuffix::Rule.factory("!congresodelalengua3.ar")
322
322
  # # => #<PublicSuffix::Rule::Exception>
323
323
  #
324
- # @param [String] content The rule content.
324
+ # @param content [#to_s] the content of the rule
325
325
  # @return [PublicSuffix::Rule::*] A rule instance.
326
326
  def self.factory(content, private: false)
327
327
  case content.to_s[0, 1]
@@ -5,9 +5,11 @@
5
5
  #
6
6
  # Domain name parser based on the Public Suffix List.
7
7
  #
8
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
8
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
9
9
 
10
10
  module PublicSuffix
11
- # The current library version.
12
- VERSION = "4.0.6"
11
+
12
+ # @return [String] The current library version.
13
+ VERSION = "4.0.7"
14
+
13
15
  end
data/lib/public_suffix.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  require_relative "public_suffix/domain"
10
10
  require_relative "public_suffix/version"
@@ -57,15 +57,13 @@ module PublicSuffix
57
57
  # # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
58
58
  #
59
59
  #
60
- # @param [String, #to_s] name The domain name or fully qualified domain name to parse.
61
- # @param [PublicSuffix::List] list The rule list to search, defaults to the default {PublicSuffix::List}
62
- # @param [Boolean] ignore_private
60
+ # @param name [#to_s] The domain name or fully qualified domain name to parse.
61
+ # @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
62
+ # @param ignore_private [Boolean]
63
63
  # @return [PublicSuffix::Domain]
64
64
  #
65
- # @raise [PublicSuffix::DomainInvalid]
66
- # If domain is not a valid domain.
67
- # @raise [PublicSuffix::DomainNotAllowed]
68
- # If a rule for +domain+ is found, but the rule doesn't allow +domain+.
65
+ # @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
66
+ # @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
69
67
  def self.parse(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
70
68
  what = normalize(name)
71
69
  raise what if what.is_a?(DomainInvalid)
@@ -119,8 +117,8 @@ module PublicSuffix
119
117
  # # => false
120
118
  #
121
119
  #
122
- # @param [String, #to_s] name The domain name or fully qualified domain name to validate.
123
- # @param [Boolean] ignore_private
120
+ # @param name [#to_s] The domain name or fully qualified domain name to validate.
121
+ # @param ignore_private [Boolean]
124
122
  # @return [Boolean]
125
123
  def self.valid?(name, list: List.default, default_rule: list.default_rule, ignore_private: false)
126
124
  what = normalize(name)
@@ -135,9 +133,9 @@ module PublicSuffix
135
133
  #
136
134
  # This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
137
135
  #
138
- # @param [String, #to_s] name The domain name or fully qualified domain name to parse.
139
- # @param [PublicSuffix::List] list The rule list to search, defaults to the default {PublicSuffix::List}
140
- # @param [Boolean] ignore_private
136
+ # @param name [#to_s] The domain name or fully qualified domain name to parse.
137
+ # @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
138
+ # @param ignore_private [Boolean]
141
139
  # @return [String]
142
140
  def self.domain(name, **options)
143
141
  parse(name, **options).domain
data/test/test_helper.rb CHANGED
@@ -1,13 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if ENV["COVERAGE"]
4
- require "simplecov"
5
- SimpleCov.start
6
-
7
- require "codecov"
8
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
9
- end
10
-
11
3
  require "minitest/autorun"
12
4
  require "minitest/reporters"
13
5
  require "mocha/minitest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: public_suffix
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.6
4
+ version: 4.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-02 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: PublicSuffix can parse and decompose a domain name into top level domain,
14
14
  domain and subdomains.
@@ -20,11 +20,12 @@ extra_rdoc_files:
20
20
  - LICENSE.txt
21
21
  files:
22
22
  - ".github/FUNDING.yml"
23
+ - ".github/dependabot.yml"
24
+ - ".github/workflows/release.yml"
23
25
  - ".github/workflows/tests.yml"
24
26
  - ".gitignore"
25
27
  - ".rubocop.yml"
26
28
  - ".rubocop_opinionated.yml"
27
- - ".travis.yml"
28
29
  - ".yardopts"
29
30
  - 2.0-Upgrade.md
30
31
  - CHANGELOG.md
@@ -34,7 +35,6 @@ files:
34
35
  - Rakefile
35
36
  - SECURITY.md
36
37
  - bin/console
37
- - codecov.yml
38
38
  - data/list.txt
39
39
  - lib/public_suffix.rb
40
40
  - lib/public_suffix/domain.rb
@@ -71,9 +71,9 @@ licenses:
71
71
  metadata:
72
72
  bug_tracker_uri: https://github.com/weppos/publicsuffix-ruby/issues
73
73
  changelog_uri: https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md
74
- documentation_uri: https://rubydoc.info/gems/public_suffix/4.0.6
74
+ documentation_uri: https://rubydoc.info/gems/public_suffix/4.0.7
75
75
  homepage_uri: https://simonecarletti.com/code/publicsuffix-ruby
76
- source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v4.0.6
76
+ source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v4.0.7
77
77
  post_install_message:
78
78
  rdoc_options: []
79
79
  require_paths:
@@ -89,29 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  requirements: []
92
- rubygems_version: 3.1.2
92
+ rubygems_version: 3.3.7
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Domain name parser based on the Public Suffix List.
96
- test_files:
97
- - test/acceptance_test.rb
98
- - test/benchmarks/bm_find.rb
99
- - test/benchmarks/bm_find_all.rb
100
- - test/benchmarks/bm_names.rb
101
- - test/benchmarks/bm_select.rb
102
- - test/benchmarks/bm_select_incremental.rb
103
- - test/benchmarks/bm_valid.rb
104
- - test/profilers/domain_profiler.rb
105
- - test/profilers/find_profiler.rb
106
- - test/profilers/find_profiler_jp.rb
107
- - test/profilers/initialization_profiler.rb
108
- - test/profilers/list_profsize.rb
109
- - test/profilers/object_binsize.rb
110
- - test/psl_test.rb
111
- - test/test_helper.rb
112
- - test/tests.txt
113
- - test/unit/domain_test.rb
114
- - test/unit/errors_test.rb
115
- - test/unit/list_test.rb
116
- - test/unit/public_suffix_test.rb
117
- - test/unit/rule_test.rb
96
+ test_files: []
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- # - 2.3
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
- - 2.7
9
- - ruby-head
10
-
11
- env:
12
- - COVERAGE=1
13
-
14
- cache:
15
- - bundler
16
-
17
- matrix:
18
- allow_failures:
19
- - rvm: ruby-head
20
-
21
- before_install:
22
- - gem update --system
23
- - gem install bundler
data/codecov.yml DELETED
@@ -1,12 +0,0 @@
1
- # https://docs.codecov.io/docs/coverage-configuration
2
- coverage:
3
- precision: 1
4
- round: down
5
- status:
6
- project:
7
- default: false
8
- patch:
9
- default: false
10
-
11
- # https://docs.codecov.io/docs/pull-request-comments#section-requiring-changes
12
- comment: off