public_suffix 4.0.7 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +74 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +10 -5
  5. data/SECURITY.md +3 -83
  6. data/data/list.txt +4175 -2367
  7. data/lib/public_suffix/domain.rb +1 -1
  8. data/lib/public_suffix/errors.rb +1 -1
  9. data/lib/public_suffix/list.rb +2 -2
  10. data/lib/public_suffix/rule.rb +7 -7
  11. data/lib/public_suffix/version.rb +3 -4
  12. data/lib/public_suffix.rb +2 -2
  13. metadata +9 -43
  14. data/.github/FUNDING.yml +0 -12
  15. data/.github/dependabot.yml +0 -8
  16. data/.github/workflows/release.yml +0 -16
  17. data/.github/workflows/tests.yml +0 -28
  18. data/.gitignore +0 -8
  19. data/.rubocop.yml +0 -36
  20. data/.rubocop_opinionated.yml +0 -163
  21. data/2.0-Upgrade.md +0 -52
  22. data/Gemfile +0 -14
  23. data/Rakefile +0 -52
  24. data/bin/console +0 -15
  25. data/public_suffix.gemspec +0 -29
  26. data/test/.empty +0 -2
  27. data/test/acceptance_test.rb +0 -131
  28. data/test/benchmarks/bm_find.rb +0 -66
  29. data/test/benchmarks/bm_find_all.rb +0 -102
  30. data/test/benchmarks/bm_names.rb +0 -91
  31. data/test/benchmarks/bm_select.rb +0 -26
  32. data/test/benchmarks/bm_select_incremental.rb +0 -25
  33. data/test/benchmarks/bm_valid.rb +0 -101
  34. data/test/profilers/domain_profiler.rb +0 -12
  35. data/test/profilers/find_profiler.rb +0 -12
  36. data/test/profilers/find_profiler_jp.rb +0 -12
  37. data/test/profilers/initialization_profiler.rb +0 -11
  38. data/test/profilers/list_profsize.rb +0 -11
  39. data/test/profilers/object_binsize.rb +0 -57
  40. data/test/psl_test.rb +0 -52
  41. data/test/test_helper.rb +0 -10
  42. data/test/tests.txt +0 -98
  43. data/test/unit/domain_test.rb +0 -106
  44. data/test/unit/errors_test.rb +0 -25
  45. data/test/unit/list_test.rb +0 -241
  46. data/test/unit/public_suffix_test.rb +0 -188
  47. data/test/unit/rule_test.rb +0 -222
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 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-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 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-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -87,7 +87,7 @@ module PublicSuffix
87
87
  section = 2
88
88
 
89
89
  # skip comments
90
- when line.start_with?(comment_token)
90
+ when line.start_with?(comment_token) # rubocop:disable Lint/DuplicateBranch
91
91
  next
92
92
 
93
93
  else
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # Domain name parser based on the Public Suffix List.
6
6
  #
7
- # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  module PublicSuffix
10
10
 
@@ -125,7 +125,7 @@ module PublicSuffix
125
125
  # @param private [Boolean]
126
126
  def initialize(value:, length: nil, private: false)
127
127
  @value = value.to_s
128
- @length = length || @value.count(DOT) + 1
128
+ @length = length || (@value.count(DOT) + 1)
129
129
  @private = private
130
130
  end
131
131
 
@@ -161,7 +161,7 @@ module PublicSuffix
161
161
  # @param name [String] the domain name to check
162
162
  # @return [Boolean]
163
163
  def match?(name)
164
- # Note: it works because of the assumption there are no
164
+ # NOTE: it works because of the assumption there are no
165
165
  # rules like foo.*.com. If the assumption is incorrect,
166
166
  # we need to properly walk the input and skip parts according
167
167
  # to wildcard component.
@@ -221,7 +221,7 @@ module PublicSuffix
221
221
  # @param content [String] the content of the rule
222
222
  # @param private [Boolean]
223
223
  def self.build(content, private: false)
224
- new(value: content.to_s[2..-1], private: private)
224
+ new(value: content.to_s[2..], private: private)
225
225
  end
226
226
 
227
227
  # Initializes a new rule.
@@ -230,7 +230,7 @@ module PublicSuffix
230
230
  # @param length [Integer]
231
231
  # @param private [Boolean]
232
232
  def initialize(value:, length: nil, private: false)
233
- super(value: value, length: length, private: private)
233
+ super
234
234
  length or @length += 1 # * counts as 1
235
235
  end
236
236
 
@@ -269,7 +269,7 @@ module PublicSuffix
269
269
  # @param content [#to_s] the content of the rule
270
270
  # @param private [Boolean]
271
271
  def self.build(content, private: false)
272
- new(value: content.to_s[1..-1], private: private)
272
+ new(value: content.to_s[1..], private: private)
273
273
  end
274
274
 
275
275
  # Gets the original rule definition.
@@ -299,7 +299,7 @@ module PublicSuffix
299
299
  #
300
300
  # @return [Array<String>]
301
301
  def parts
302
- @value.split(DOT)[1..-1]
302
+ @value.split(DOT)[1..]
303
303
  end
304
304
 
305
305
  end
@@ -1,15 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- #
4
3
  # = Public Suffix
5
4
  #
6
5
  # Domain name parser based on the Public Suffix List.
7
6
  #
8
- # Copyright (c) 2009-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
9
8
 
10
9
  module PublicSuffix
11
10
 
12
- # @return [String] The current library version.
13
- VERSION = "4.0.7"
11
+ # @return [String] the current library version
12
+ VERSION = "6.0.1"
14
13
 
15
14
  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-2022 Simone Carletti <weppos@weppos.net>
7
+ # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net>
8
8
 
9
9
  require_relative "public_suffix/domain"
10
10
  require_relative "public_suffix/version"
@@ -169,7 +169,7 @@ module PublicSuffix
169
169
 
170
170
  return DomainInvalid.new("Name is blank") if name.empty?
171
171
  return DomainInvalid.new("Name starts with a dot") if name.start_with?(DOT)
172
- return DomainInvalid.new("%s is not expected to contain a scheme" % name) if name.include?("://")
172
+ return DomainInvalid.new(format("%s is not expected to contain a scheme", name)) if name.include?("://")
173
173
 
174
174
  name
175
175
  end
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.7
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-12 00:00:00.000000000 Z
11
+ date: 2024-07-23 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.
@@ -19,22 +19,11 @@ extensions: []
19
19
  extra_rdoc_files:
20
20
  - LICENSE.txt
21
21
  files:
22
- - ".github/FUNDING.yml"
23
- - ".github/dependabot.yml"
24
- - ".github/workflows/release.yml"
25
- - ".github/workflows/tests.yml"
26
- - ".gitignore"
27
- - ".rubocop.yml"
28
- - ".rubocop_opinionated.yml"
29
22
  - ".yardopts"
30
- - 2.0-Upgrade.md
31
23
  - CHANGELOG.md
32
- - Gemfile
33
24
  - LICENSE.txt
34
25
  - README.md
35
- - Rakefile
36
26
  - SECURITY.md
37
- - bin/console
38
27
  - data/list.txt
39
28
  - lib/public_suffix.rb
40
29
  - lib/public_suffix/domain.rb
@@ -42,39 +31,16 @@ files:
42
31
  - lib/public_suffix/list.rb
43
32
  - lib/public_suffix/rule.rb
44
33
  - lib/public_suffix/version.rb
45
- - public_suffix.gemspec
46
- - test/.empty
47
- - test/acceptance_test.rb
48
- - test/benchmarks/bm_find.rb
49
- - test/benchmarks/bm_find_all.rb
50
- - test/benchmarks/bm_names.rb
51
- - test/benchmarks/bm_select.rb
52
- - test/benchmarks/bm_select_incremental.rb
53
- - test/benchmarks/bm_valid.rb
54
- - test/profilers/domain_profiler.rb
55
- - test/profilers/find_profiler.rb
56
- - test/profilers/find_profiler_jp.rb
57
- - test/profilers/initialization_profiler.rb
58
- - test/profilers/list_profsize.rb
59
- - test/profilers/object_binsize.rb
60
- - test/psl_test.rb
61
- - test/test_helper.rb
62
- - test/tests.txt
63
- - test/unit/domain_test.rb
64
- - test/unit/errors_test.rb
65
- - test/unit/list_test.rb
66
- - test/unit/public_suffix_test.rb
67
- - test/unit/rule_test.rb
68
34
  homepage: https://simonecarletti.com/code/publicsuffix-ruby
69
35
  licenses:
70
36
  - MIT
71
37
  metadata:
72
38
  bug_tracker_uri: https://github.com/weppos/publicsuffix-ruby/issues
73
39
  changelog_uri: https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md
74
- documentation_uri: https://rubydoc.info/gems/public_suffix/4.0.7
40
+ documentation_uri: https://rubydoc.info/gems/public_suffix/6.0.1
75
41
  homepage_uri: https://simonecarletti.com/code/publicsuffix-ruby
76
- source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v4.0.7
77
- post_install_message:
42
+ source_code_uri: https://github.com/weppos/publicsuffix-ruby/tree/v6.0.1
43
+ post_install_message:
78
44
  rdoc_options: []
79
45
  require_paths:
80
46
  - lib
@@ -82,15 +48,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
48
  requirements:
83
49
  - - ">="
84
50
  - !ruby/object:Gem::Version
85
- version: '2.3'
51
+ version: '3.0'
86
52
  required_rubygems_version: !ruby/object:Gem::Requirement
87
53
  requirements:
88
54
  - - ">="
89
55
  - !ruby/object:Gem::Version
90
56
  version: '0'
91
57
  requirements: []
92
- rubygems_version: 3.3.7
93
- signing_key:
58
+ rubygems_version: 3.5.11
59
+ signing_key:
94
60
  specification_version: 4
95
61
  summary: Domain name parser based on the Public Suffix List.
96
62
  test_files: []
data/.github/FUNDING.yml DELETED
@@ -1,12 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: # Replace with a single Open Collective username
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: "rubygems/public_suffix"
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- otechie: # Replace with a single Otechie username
12
- custom: # Replace with a single custom sponsorship URL
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "04:00"
8
- open-pull-requests-limit: 10
@@ -1,16 +0,0 @@
1
- name: release
2
-
3
- on:
4
- push:
5
- tags:
6
- - v*.*.*
7
- jobs:
8
- release:
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@v2
12
- - name: Release Gem
13
- uses: cadwallion/publish-rubygems-action@8f9e0538302643309e4e43bf48cd34173ca48cfc
14
- env:
15
- RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
16
- RELEASE_COMMAND: rake release
@@ -1,28 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
-
8
- jobs:
9
- build:
10
- strategy:
11
- matrix:
12
- ruby-version:
13
- - "2.6"
14
- - "2.7"
15
- - "3.0"
16
- - "3.1"
17
- platform: [ubuntu-latest]
18
- runs-on: ${{ matrix.platform }}
19
- steps:
20
- - uses: actions/checkout@v2
21
- - name: Set up Ruby
22
- uses: ruby/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby-version }}
25
- - name: Install dependencies
26
- run: bundle install
27
- - name: Run tests
28
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # Bundler
2
- /.bundle
3
- /Gemfile.lock
4
- /pkg/*
5
-
6
- # YARD
7
- /.yardoc
8
- /yardoc/
data/.rubocop.yml DELETED
@@ -1,36 +0,0 @@
1
- inherit_from:
2
- - .rubocop_opinionated.yml
3
-
4
- AllCops:
5
- Exclude:
6
- # Exclude .gemspec files because they are generally auto-generated
7
- - '*.gemspec'
8
- # Exclude vendored folders
9
- - 'tmp/**/*'
10
- - 'vendor/**/*'
11
- # Exclude artifacts
12
- - 'pkg/**/*'
13
- # Other
14
- - 'test/benchmarks/**/*'
15
- - 'test/profilers/**/*'
16
-
17
- # I often use @_variable to avoid clashing.
18
- Naming/MemoizedInstanceVariableName:
19
- Enabled: false
20
-
21
- Style/ClassAndModuleChildren:
22
- Exclude:
23
- - 'spec/**/*_spec.rb'
24
- - 'test/**/*_test.rb'
25
-
26
- # Dear Rubocop, I don't want to use String#strip_heredoc
27
- Layout/HeredocIndentation:
28
- Enabled: false
29
-
30
- Style/WordArray:
31
- Enabled: false
32
- MinSize: 3
33
-
34
- Style/SymbolArray:
35
- Enabled: false
36
- MinSize: 3
@@ -1,163 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- # Exclude .gemspec files because they are generally auto-generated
4
- - '*.gemspec'
5
- # Exclude vendored folders
6
- - 'tmp/**/*'
7
- - 'vendor/**/*'
8
- NewCops: enable
9
-
10
- # [codesmell]
11
- Layout/LineLength:
12
- Enabled: false
13
- Exclude:
14
- - 'spec/**/*_spec.rb'
15
- - 'test/**/*_test.rb'
16
- Max: 100
17
-
18
- Lint/ConstantDefinitionInBlock:
19
- Exclude:
20
- - 'Rakefile'
21
- - 'spec/**/*'
22
- - 'test/**/*'
23
-
24
- # [codesmell]
25
- Metrics/AbcSize:
26
- Enabled: false
27
- Exclude:
28
- - 'spec/**/*_spec.rb'
29
- - 'test/**/*_test.rb'
30
-
31
- # [codesmell]
32
- Metrics/BlockLength:
33
- Enabled: false
34
-
35
- # [codesmell]
36
- Metrics/CyclomaticComplexity:
37
- Enabled: false
38
- Exclude:
39
- - 'spec/**/*_spec.rb'
40
- - 'test/**/*_test.rb'
41
-
42
- # [codesmell]
43
- Metrics/ClassLength:
44
- Enabled: false
45
- Exclude:
46
- - 'spec/**/*_spec.rb'
47
- - 'test/**/*_test.rb'
48
-
49
- # [codesmell]
50
- Metrics/MethodLength:
51
- Enabled: false
52
- Exclude:
53
- - 'spec/**/*_spec.rb'
54
- - 'test/**/*_test.rb'
55
- Max: 10
56
-
57
- # [codesmell]
58
- Metrics/ModuleLength:
59
- Enabled: false
60
- Exclude:
61
- - 'spec/**/*_spec.rb'
62
- - 'test/**/*_test.rb'
63
-
64
- # [codesmell]
65
- Metrics/ParameterLists:
66
- Enabled: false
67
- Max: 5
68
-
69
- # [codesmell]
70
- Metrics/PerceivedComplexity:
71
- Enabled: false
72
-
73
- # Do not use "and" or "or" in conditionals, but for readability we can use it
74
- # to chain executions. Just beware of operator order.
75
- Style/AndOr:
76
- EnforcedStyle: conditionals
77
-
78
- Style/Documentation:
79
- Exclude:
80
- - 'spec/**/*'
81
- - 'test/**/*'
82
-
83
- # Double empty lines are useful to separate conceptually different methods
84
- # in the same class or module.
85
- Layout/EmptyLines:
86
- Enabled: false
87
-
88
- # In most cases, a space is nice. Sometimes, it's not.
89
- # Just be consistent with the rest of the surrounding code.
90
- Layout/EmptyLinesAroundClassBody:
91
- Enabled: false
92
-
93
- # In most cases, a space is nice. Sometimes, it's not.
94
- # Just be consistent with the rest of the surrounding code.
95
- Layout/EmptyLinesAroundModuleBody:
96
- Enabled: false
97
-
98
- # This is quite buggy, as it doesn't recognize double lines.
99
- # Double empty lines are useful to separate conceptually different methods
100
- # in the same class or module.
101
- Layout/EmptyLineBetweenDefs:
102
- Enabled: false
103
-
104
- # I personally don't care about the format style.
105
- # In most cases I like to use %, but not at the point I want to enforce it
106
- # as a convention in the entire code.
107
- Style/FormatString:
108
- Enabled: false
109
-
110
- # Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
111
- # %s is a simpler and straightforward version that works in almost all cases. So don't complain.
112
- Style/FormatStringToken:
113
- Enabled: false
114
-
115
- # unless is not always cool.
116
- Style/NegatedIf:
117
- Enabled: false
118
-
119
- # For years, %w() has been the de-facto standard. A lot of libraries are using ().
120
- # Switching to [] would be a nightmare.
121
- Style/PercentLiteralDelimiters:
122
- Enabled: false
123
-
124
- # There are cases were the inline rescue is ok. We can either downgrade the severity,
125
- # or rely on the developer judgement on a case-by-case basis.
126
- Style/RescueModifier:
127
- Enabled: false
128
-
129
- Style/SymbolArray:
130
- EnforcedStyle: brackets
131
-
132
- # Sorry, but using trailing spaces helps readability.
133
- #
134
- # %w( foo bar )
135
- #
136
- # looks better to me than
137
- #
138
- # %w( foo bar )
139
- #
140
- Layout/SpaceInsidePercentLiteralDelimiters:
141
- Enabled: false
142
-
143
- # Hate It or Love It, I prefer double quotes as this is more consistent
144
- # with several other programming languages and the output of puts and inspect.
145
- Style/StringLiterals:
146
- EnforcedStyle: double_quotes
147
-
148
- # It's nice to be consistent. The trailing comma also allows easy reordering,
149
- # and doesn't cause a diff in Git when you add a line to the bottom.
150
- Style/TrailingCommaInArrayLiteral:
151
- EnforcedStyleForMultiline: consistent_comma
152
- Style/TrailingCommaInHashLiteral:
153
- EnforcedStyleForMultiline: consistent_comma
154
-
155
- Style/TrivialAccessors:
156
- # IgnoreClassMethods because I want to be able to define class-level accessors
157
- # that sets an instance variable on the metaclass, such as:
158
- #
159
- # def self.default=(value)
160
- # @default = value
161
- # end
162
- #
163
- IgnoreClassMethods: true
data/2.0-Upgrade.md DELETED
@@ -1,52 +0,0 @@
1
- # Welcome to PublicSuffix 2.0!
2
-
3
- PublicSuffix 2.0 contains a rewritten internal representation and comparison logic, that drastically increases the lookup performance. The new version also changes several internal and external API.
4
-
5
- This document documents the most relevant changes to help you upgrading from PublicSuffix 1.0 to 2.0.
6
-
7
- ## What's New
8
-
9
- - The library is now 100% compliants with the official PublicSuffix tests. The major breaking change you may experience, is that if a domain passed as input doesn't match any rule, the rule `*` is assumed. You can override this behavior by passing a custom default rule with the `default_rule` option. The old behavior can be restored by passing `default_rule: nil`.
10
- - `PublicSuffix.domain` is a new method that parses the input and returns the domain (combination of second level domain + suffix). This is a convenient helper to parse a domain name, for example when you need to determine the cookie or SSL scope.
11
- - Added the ability to disable the use of private domains either at runtime, in addition to the ability to not load the private domains section when reading the list (`private_domains: false`). This feature also superseded the `private_domains` class-level attribute, that is no longer available.
12
-
13
- ## Upgrade
14
-
15
- When upgrading, here's the most relevant changes to keep an eye on:
16
-
17
- - Several futile utility helpers were removed, such as `Domain#rule`, `Domain#is_a_domain?`, `Domain#is_a_subdomain?`, `Domain#valid?`. You can easily obtain the same result by having a custom method that reconstructs the logic, and/or calling `PublicSuffix.{domain|parse}(domain.to_s)`.
18
- - `PublicSuffix::List.private_domains` is no longer available. Instead, you now have two ways to enable/disable the private domains:
19
-
20
- 1. At runtime, by using the `ignore_private` option
21
-
22
- ```ruby
23
- PublicSuffix.domain("something.blogspot.com", ignore_private: true)
24
- ```
25
-
26
- 1. Loading a filtered list:
27
-
28
- ```ruby
29
- # Disable support for private TLDs
30
- PublicSuffix::List.default = PublicSuffix::List.parse(File.read(PublicSuffix::List::DEFAULT_LIST_PATH), private_domains: false)
31
- # => "blogspot.com"
32
- PublicSuffix.domain("something.blogspot.com")
33
- # => "blogspot.com"
34
- ```
35
- - Now that the library is 100% compliant with the official PublicSuffix algorithm, if a domain passed as input doesn't match any rule, the wildcard rule `*` is assumed. This means that unlisted TLDs will be considered valid by default, when they would have been invalid in 1.x. However, you can override this behavior to emulate the 1.x behavior if needed:
36
-
37
- ```ruby
38
- # 1.x:
39
-
40
- PublicSuffix.valid?("google.commm")
41
- # => false
42
-
43
- # 2.x:
44
-
45
- PublicSuffix.valid?("google.commm")
46
- # => true
47
-
48
- # Overriding 2.x behavior if needed:
49
-
50
- PublicSuffix.valid?("google.commm", default_rule: nil)
51
- # => false
52
- ````
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- gem "rake"
8
-
9
- gem "memory_profiler", require: false
10
- gem "minitest"
11
- gem "minitest-reporters"
12
- gem "mocha"
13
- gem "rubocop", "~>0.90", require: false
14
- gem "yard"
data/Rakefile DELETED
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
-
5
- # By default, run tests and linter.
6
- task default: [:test, :rubocop]
7
-
8
-
9
- require "rake/testtask"
10
-
11
- Rake::TestTask.new do |t|
12
- t.libs = %w( lib test )
13
- t.pattern = "test/**/*_test.rb"
14
- t.verbose = !ENV["VERBOSE"].nil?
15
- t.warning = !ENV["WARNING"].nil?
16
- end
17
-
18
- require "rubocop/rake_task"
19
-
20
- RuboCop::RakeTask.new
21
-
22
-
23
- require "yard"
24
- require "yard/rake/yardoc_task"
25
-
26
- YARD::Rake::YardocTask.new(:yardoc) do |y|
27
- y.options = ["--output-dir", "yardoc"]
28
- end
29
-
30
- CLOBBER.include "yardoc"
31
-
32
-
33
- task :benchmarks do
34
- Dir["benchmarks/bm_*.rb"].each do |file|
35
- sh "ruby #{file}"
36
- end
37
- end
38
- task default: [:benchmarks] if ENV["BENCHMARKS"] == "1"
39
-
40
-
41
- desc "Downloads the Public Suffix List file from the repository and stores it locally."
42
- task :"update-list" do
43
- require "net/http"
44
-
45
- DEFINITION_URL = "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat"
46
-
47
- File.open("data/list.txt", "w+") do |f|
48
- response = Net::HTTP.get_response(URI.parse(DEFINITION_URL))
49
- response.body
50
- f.write(response.body)
51
- end
52
- end
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "public_suffix"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start
@@ -1,29 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.push File.expand_path("../lib", __FILE__)
3
- require "public_suffix/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "public_suffix"
7
- s.version = PublicSuffix::VERSION
8
- s.authors = ["Simone Carletti"]
9
- s.email = ["weppos@weppos.net"]
10
- s.homepage = "https://simonecarletti.com/code/publicsuffix-ruby"
11
- s.summary = "Domain name parser based on the Public Suffix List."
12
- s.description = "PublicSuffix can parse and decompose a domain name into top level domain, domain and subdomains."
13
- s.licenses = ["MIT"]
14
-
15
- s.metadata = {
16
- "bug_tracker_uri" => "https://github.com/weppos/publicsuffix-ruby/issues",
17
- "changelog_uri" => "https://github.com/weppos/publicsuffix-ruby/blob/master/CHANGELOG.md",
18
- "documentation_uri" => "https://rubydoc.info/gems/#{s.name}/#{s.version}",
19
- "homepage_uri" => s.homepage,
20
- "source_code_uri" => "https://github.com/weppos/publicsuffix-ruby/tree/v#{s.version}",
21
- }
22
-
23
- s.required_ruby_version = ">= 2.3"
24
-
25
- s.require_paths = ["lib"]
26
- s.files = `git ls-files`.split("\n")
27
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
28
- s.extra_rdoc_files = %w( LICENSE.txt )
29
- end