danger-packwerk 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
- data/lib/danger-packwerk/version.rb +1 -1
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
- data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
- data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
- data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
- data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
- data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
- data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
- data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
- data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
- data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
- data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
- data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
- data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
- data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
- data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
- data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
- data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
- data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
- data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
- data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
- data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
- data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
- data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
- data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
- data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
- data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
- data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
- data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
- data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
- data/sorbet/rbi/todo.rbi +122 -0
- metadata +84 -7
- data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,779 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `public_suffix` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem public_suffix`.
|
6
|
+
|
7
|
+
module PublicSuffix
|
8
|
+
class << self
|
9
|
+
# private
|
10
|
+
def decompose(name, rule); end
|
11
|
+
|
12
|
+
# Attempt to parse the name and returns the domain, if valid.
|
13
|
+
#
|
14
|
+
# This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
|
15
|
+
#
|
16
|
+
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
17
|
+
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
18
|
+
# @param ignore_private [Boolean]
|
19
|
+
# @return [String]
|
20
|
+
def domain(name, **options); end
|
21
|
+
|
22
|
+
# Pretend we know how to deal with user input.
|
23
|
+
def normalize(name); end
|
24
|
+
|
25
|
+
# Parses +name+ and returns the {PublicSuffix::Domain} instance.
|
26
|
+
#
|
27
|
+
# @example Parse a valid domain
|
28
|
+
# PublicSuffix.parse("google.com")
|
29
|
+
# # => #<PublicSuffix::Domain:0x007fec2e51e588 @sld="google", @tld="com", @trd=nil>
|
30
|
+
# @example Parse a valid subdomain
|
31
|
+
# PublicSuffix.parse("www.google.com")
|
32
|
+
# # => #<PublicSuffix::Domain:0x007fec276d4cf8 @sld="google", @tld="com", @trd="www">
|
33
|
+
# @example Parse a fully qualified domain
|
34
|
+
# PublicSuffix.parse("google.com.")
|
35
|
+
# # => #<PublicSuffix::Domain:0x007fec257caf38 @sld="google", @tld="com", @trd=nil>
|
36
|
+
# @example Parse a fully qualified domain (subdomain)
|
37
|
+
# PublicSuffix.parse("www.google.com.")
|
38
|
+
# # => #<PublicSuffix::Domain:0x007fec27b6bca8 @sld="google", @tld="com", @trd="www">
|
39
|
+
# @example Parse an invalid (unlisted) domain
|
40
|
+
# PublicSuffix.parse("x.yz")
|
41
|
+
# # => #<PublicSuffix::Domain:0x007fec2f49bec0 @sld="x", @tld="yz", @trd=nil>
|
42
|
+
# @example Parse an invalid (unlisted) domain with strict checking (without applying the default * rule)
|
43
|
+
# PublicSuffix.parse("x.yz", default_rule: nil)
|
44
|
+
# # => PublicSuffix::DomainInvalid: `x.yz` is not a valid domain
|
45
|
+
# @example Parse an URL (not supported, only domains)
|
46
|
+
# PublicSuffix.parse("http://www.google.com")
|
47
|
+
# # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
|
48
|
+
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
49
|
+
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
50
|
+
# @param ignore_private [Boolean]
|
51
|
+
# @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
|
52
|
+
# @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
|
53
|
+
# @return [PublicSuffix::Domain]
|
54
|
+
def parse(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
|
55
|
+
|
56
|
+
# Checks whether +domain+ is assigned and allowed, without actually parsing it.
|
57
|
+
#
|
58
|
+
# This method doesn't care whether domain is a domain or subdomain.
|
59
|
+
# The validation is performed using the default {PublicSuffix::List}.
|
60
|
+
#
|
61
|
+
# @example Validate a valid domain
|
62
|
+
# PublicSuffix.valid?("example.com")
|
63
|
+
# # => true
|
64
|
+
# @example Validate a valid subdomain
|
65
|
+
# PublicSuffix.valid?("www.example.com")
|
66
|
+
# # => true
|
67
|
+
# @example Validate a not-listed domain
|
68
|
+
# PublicSuffix.valid?("example.tldnotlisted")
|
69
|
+
# # => true
|
70
|
+
# @example Validate a not-listed domain with strict checking (without applying the default * rule)
|
71
|
+
# PublicSuffix.valid?("example.tldnotlisted")
|
72
|
+
# # => true
|
73
|
+
# PublicSuffix.valid?("example.tldnotlisted", default_rule: nil)
|
74
|
+
# # => false
|
75
|
+
# @example Validate a fully qualified domain
|
76
|
+
# PublicSuffix.valid?("google.com.")
|
77
|
+
# # => true
|
78
|
+
# PublicSuffix.valid?("www.google.com.")
|
79
|
+
# # => true
|
80
|
+
# @example Check an URL (which is not a valid domain)
|
81
|
+
# PublicSuffix.valid?("http://www.example.com")
|
82
|
+
# # => false
|
83
|
+
# @param name [#to_s] The domain name or fully qualified domain name to validate.
|
84
|
+
# @param ignore_private [Boolean]
|
85
|
+
# @return [Boolean]
|
86
|
+
def valid?(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
PublicSuffix::BANG = T.let(T.unsafe(nil), String)
|
91
|
+
PublicSuffix::DOT = T.let(T.unsafe(nil), String)
|
92
|
+
|
93
|
+
# Domain represents a domain name, composed by a TLD, SLD and TRD.
|
94
|
+
class PublicSuffix::Domain
|
95
|
+
# Creates and returns a new {PublicSuffix::Domain} instance.
|
96
|
+
#
|
97
|
+
# @example Initialize with a TLD and SLD
|
98
|
+
# PublicSuffix::Domain.new("com", "example")
|
99
|
+
# # => #<PublicSuffix::Domain @tld="com", @trd=nil>
|
100
|
+
# @example Initialize with a TLD
|
101
|
+
# PublicSuffix::Domain.new("com")
|
102
|
+
# # => #<PublicSuffix::Domain @tld="com">
|
103
|
+
# @example Initialize with a TLD, SLD and TRD
|
104
|
+
# PublicSuffix::Domain.new("com", "example", "wwww")
|
105
|
+
# # => #<PublicSuffix::Domain @tld="com", @trd=nil, @sld="example">
|
106
|
+
# @overload initialize
|
107
|
+
# @overload initialize
|
108
|
+
# @overload initialize
|
109
|
+
# @return [Domain] a new instance of Domain
|
110
|
+
# @yield [self] Yields on self.
|
111
|
+
# @yieldparam self [PublicSuffix::Domain] The newly creates instance
|
112
|
+
def initialize(*args); end
|
113
|
+
|
114
|
+
# Returns a domain-like representation of this object
|
115
|
+
# if the object is a {#domain?}, <tt>nil</tt> otherwise.
|
116
|
+
#
|
117
|
+
# PublicSuffix::Domain.new("com").domain
|
118
|
+
# # => nil
|
119
|
+
#
|
120
|
+
# PublicSuffix::Domain.new("com", "google").domain
|
121
|
+
# # => "google.com"
|
122
|
+
#
|
123
|
+
# PublicSuffix::Domain.new("com", "google", "www").domain
|
124
|
+
# # => "www.google.com"
|
125
|
+
#
|
126
|
+
# This method doesn't validate the input. It handles the domain
|
127
|
+
# as a valid domain name and simply applies the necessary transformations.
|
128
|
+
#
|
129
|
+
# This method returns a FQD, not just the domain part.
|
130
|
+
# To get the domain part, use <tt>#sld</tt> (aka second level domain).
|
131
|
+
#
|
132
|
+
# PublicSuffix::Domain.new("com", "google", "www").domain
|
133
|
+
# # => "google.com"
|
134
|
+
#
|
135
|
+
# PublicSuffix::Domain.new("com", "google", "www").sld
|
136
|
+
# # => "google"
|
137
|
+
#
|
138
|
+
# @return [String]
|
139
|
+
# @see #domain?
|
140
|
+
# @see #subdomain
|
141
|
+
def domain; end
|
142
|
+
|
143
|
+
# Checks whether <tt>self</tt> looks like a domain.
|
144
|
+
#
|
145
|
+
# This method doesn't actually validate the domain.
|
146
|
+
# It only checks whether the instance contains
|
147
|
+
# a value for the {#tld} and {#sld} attributes.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
#
|
151
|
+
# PublicSuffix::Domain.new("com").domain?
|
152
|
+
# # => false
|
153
|
+
#
|
154
|
+
# PublicSuffix::Domain.new("com", "google").domain?
|
155
|
+
# # => true
|
156
|
+
#
|
157
|
+
# PublicSuffix::Domain.new("com", "google", "www").domain?
|
158
|
+
# # => true
|
159
|
+
#
|
160
|
+
# # This is an invalid domain, but returns true
|
161
|
+
# # because this method doesn't validate the content.
|
162
|
+
# PublicSuffix::Domain.new("com", nil).domain?
|
163
|
+
# # => true
|
164
|
+
# @return [Boolean]
|
165
|
+
# @see #subdomain?
|
166
|
+
def domain?; end
|
167
|
+
|
168
|
+
# Returns the full domain name.
|
169
|
+
#
|
170
|
+
# @example Gets the domain name of a domain
|
171
|
+
# PublicSuffix::Domain.new("com", "google").name
|
172
|
+
# # => "google.com"
|
173
|
+
# @example Gets the domain name of a subdomain
|
174
|
+
# PublicSuffix::Domain.new("com", "google", "www").name
|
175
|
+
# # => "www.google.com"
|
176
|
+
# @return [String]
|
177
|
+
def name; end
|
178
|
+
|
179
|
+
# Returns the value of attribute sld.
|
180
|
+
def sld; end
|
181
|
+
|
182
|
+
# Returns a subdomain-like representation of this object
|
183
|
+
# if the object is a {#subdomain?}, <tt>nil</tt> otherwise.
|
184
|
+
#
|
185
|
+
# PublicSuffix::Domain.new("com").subdomain
|
186
|
+
# # => nil
|
187
|
+
#
|
188
|
+
# PublicSuffix::Domain.new("com", "google").subdomain
|
189
|
+
# # => nil
|
190
|
+
#
|
191
|
+
# PublicSuffix::Domain.new("com", "google", "www").subdomain
|
192
|
+
# # => "www.google.com"
|
193
|
+
#
|
194
|
+
# This method doesn't validate the input. It handles the domain
|
195
|
+
# as a valid domain name and simply applies the necessary transformations.
|
196
|
+
#
|
197
|
+
# This method returns a FQD, not just the subdomain part.
|
198
|
+
# To get the subdomain part, use <tt>#trd</tt> (aka third level domain).
|
199
|
+
#
|
200
|
+
# PublicSuffix::Domain.new("com", "google", "www").subdomain
|
201
|
+
# # => "www.google.com"
|
202
|
+
#
|
203
|
+
# PublicSuffix::Domain.new("com", "google", "www").trd
|
204
|
+
# # => "www"
|
205
|
+
#
|
206
|
+
# @return [String]
|
207
|
+
# @see #subdomain?
|
208
|
+
# @see #domain
|
209
|
+
def subdomain; end
|
210
|
+
|
211
|
+
# Checks whether <tt>self</tt> looks like a subdomain.
|
212
|
+
#
|
213
|
+
# This method doesn't actually validate the subdomain.
|
214
|
+
# It only checks whether the instance contains
|
215
|
+
# a value for the {#tld}, {#sld} and {#trd} attributes.
|
216
|
+
# If you also want to validate the domain,
|
217
|
+
# use {#valid_subdomain?} instead.
|
218
|
+
#
|
219
|
+
# @example
|
220
|
+
#
|
221
|
+
# PublicSuffix::Domain.new("com").subdomain?
|
222
|
+
# # => false
|
223
|
+
#
|
224
|
+
# PublicSuffix::Domain.new("com", "google").subdomain?
|
225
|
+
# # => false
|
226
|
+
#
|
227
|
+
# PublicSuffix::Domain.new("com", "google", "www").subdomain?
|
228
|
+
# # => true
|
229
|
+
#
|
230
|
+
# # This is an invalid domain, but returns true
|
231
|
+
# # because this method doesn't validate the content.
|
232
|
+
# PublicSuffix::Domain.new("com", "example", nil).subdomain?
|
233
|
+
# # => true
|
234
|
+
# @return [Boolean]
|
235
|
+
# @see #domain?
|
236
|
+
def subdomain?; end
|
237
|
+
|
238
|
+
# Returns the value of attribute tld.
|
239
|
+
def tld; end
|
240
|
+
|
241
|
+
# Returns an array containing the domain parts.
|
242
|
+
#
|
243
|
+
# @example
|
244
|
+
#
|
245
|
+
# PublicSuffix::Domain.new("google.com").to_a
|
246
|
+
# # => [nil, "google", "com"]
|
247
|
+
#
|
248
|
+
# PublicSuffix::Domain.new("www.google.com").to_a
|
249
|
+
# # => [nil, "google", "com"]
|
250
|
+
# @return [Array<String, nil>]
|
251
|
+
def to_a; end
|
252
|
+
|
253
|
+
# Returns a string representation of this object.
|
254
|
+
#
|
255
|
+
# @return [String]
|
256
|
+
def to_s; end
|
257
|
+
|
258
|
+
# Returns the value of attribute trd.
|
259
|
+
def trd; end
|
260
|
+
|
261
|
+
class << self
|
262
|
+
# Splits a string into the labels, that is the dot-separated parts.
|
263
|
+
#
|
264
|
+
# The input is not validated, but it is assumed to be a valid domain name.
|
265
|
+
#
|
266
|
+
# @example
|
267
|
+
#
|
268
|
+
# name_to_labels('example.com')
|
269
|
+
# # => ['example', 'com']
|
270
|
+
#
|
271
|
+
# name_to_labels('example.co.uk')
|
272
|
+
# # => ['example', 'co', 'uk']
|
273
|
+
# @param name [String, #to_s] The domain name to split.
|
274
|
+
# @return [Array<String>]
|
275
|
+
def name_to_labels(name); end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
# Raised when trying to parse an invalid name.
|
280
|
+
# A name is considered invalid when no rule is found in the definition list.
|
281
|
+
#
|
282
|
+
# @example
|
283
|
+
#
|
284
|
+
# PublicSuffix.parse("nic.test")
|
285
|
+
# # => PublicSuffix::DomainInvalid
|
286
|
+
#
|
287
|
+
# PublicSuffix.parse("http://www.nic.it")
|
288
|
+
# # => PublicSuffix::DomainInvalid
|
289
|
+
class PublicSuffix::DomainInvalid < ::PublicSuffix::Error; end
|
290
|
+
|
291
|
+
# Raised when trying to parse a name that matches a suffix.
|
292
|
+
#
|
293
|
+
# @example
|
294
|
+
#
|
295
|
+
# PublicSuffix.parse("nic.do")
|
296
|
+
# # => PublicSuffix::DomainNotAllowed
|
297
|
+
#
|
298
|
+
# PublicSuffix.parse("www.nic.do")
|
299
|
+
# # => PublicSuffix::Domain
|
300
|
+
class PublicSuffix::DomainNotAllowed < ::PublicSuffix::DomainInvalid; end
|
301
|
+
|
302
|
+
class PublicSuffix::Error < ::StandardError; end
|
303
|
+
|
304
|
+
# A {PublicSuffix::List} is a collection of one
|
305
|
+
# or more {PublicSuffix::Rule}.
|
306
|
+
#
|
307
|
+
# Given a {PublicSuffix::List},
|
308
|
+
# you can add or remove {PublicSuffix::Rule},
|
309
|
+
# iterate all items in the list or search for the first rule
|
310
|
+
# which matches a specific domain name.
|
311
|
+
#
|
312
|
+
# # Create a new list
|
313
|
+
# list = PublicSuffix::List.new
|
314
|
+
#
|
315
|
+
# # Push two rules to the list
|
316
|
+
# list << PublicSuffix::Rule.factory("it")
|
317
|
+
# list << PublicSuffix::Rule.factory("com")
|
318
|
+
#
|
319
|
+
# # Get the size of the list
|
320
|
+
# list.size
|
321
|
+
# # => 2
|
322
|
+
#
|
323
|
+
# # Search for the rule matching given domain
|
324
|
+
# list.find("example.com")
|
325
|
+
# # => #<PublicSuffix::Rule::Normal>
|
326
|
+
# list.find("example.org")
|
327
|
+
# # => nil
|
328
|
+
#
|
329
|
+
# You can create as many {PublicSuffix::List} you want.
|
330
|
+
# The {PublicSuffix::List.default} rule list is used
|
331
|
+
# to tokenize and validate a domain.
|
332
|
+
class PublicSuffix::List
|
333
|
+
# Initializes an empty {PublicSuffix::List}.
|
334
|
+
#
|
335
|
+
# @return [List] a new instance of List
|
336
|
+
# @yield [self] Yields on self.
|
337
|
+
# @yieldparam self [PublicSuffix::List] The newly created instance.
|
338
|
+
def initialize; end
|
339
|
+
|
340
|
+
# Adds the given object to the list and optionally refreshes the rule index.
|
341
|
+
#
|
342
|
+
# @param rule [PublicSuffix::Rule::*] the rule to add to the list
|
343
|
+
# @return [self]
|
344
|
+
def <<(rule); end
|
345
|
+
|
346
|
+
# Checks whether two lists are equal.
|
347
|
+
#
|
348
|
+
# List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
|
349
|
+
# {PublicSuffix::List} and each +PublicSuffix::Rule::*+
|
350
|
+
# in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
|
351
|
+
#
|
352
|
+
# @param other [PublicSuffix::List] the List to compare
|
353
|
+
# @return [Boolean]
|
354
|
+
def ==(other); end
|
355
|
+
|
356
|
+
# Adds the given object to the list and optionally refreshes the rule index.
|
357
|
+
#
|
358
|
+
# @param rule [PublicSuffix::Rule::*] the rule to add to the list
|
359
|
+
# @return [self]
|
360
|
+
def add(rule); end
|
361
|
+
|
362
|
+
# Removes all rules.
|
363
|
+
#
|
364
|
+
# @return [self]
|
365
|
+
def clear; end
|
366
|
+
|
367
|
+
# Gets the default rule.
|
368
|
+
#
|
369
|
+
# @return [PublicSuffix::Rule::*]
|
370
|
+
# @see PublicSuffix::Rule.default_rule
|
371
|
+
def default_rule; end
|
372
|
+
|
373
|
+
# Iterates each rule in the list.
|
374
|
+
def each(&block); end
|
375
|
+
|
376
|
+
# Checks whether the list is empty.
|
377
|
+
#
|
378
|
+
# @return [Boolean]
|
379
|
+
def empty?; end
|
380
|
+
|
381
|
+
# Checks whether two lists are equal.
|
382
|
+
#
|
383
|
+
# List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
|
384
|
+
# {PublicSuffix::List} and each +PublicSuffix::Rule::*+
|
385
|
+
# in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
|
386
|
+
#
|
387
|
+
# @param other [PublicSuffix::List] the List to compare
|
388
|
+
# @return [Boolean]
|
389
|
+
def eql?(other); end
|
390
|
+
|
391
|
+
# Finds and returns the rule corresponding to the longest public suffix for the hostname.
|
392
|
+
#
|
393
|
+
# @param name [#to_s] the hostname
|
394
|
+
# @param default [PublicSuffix::Rule::*] the default rule to return in case no rule matches
|
395
|
+
# @return [PublicSuffix::Rule::*]
|
396
|
+
def find(name, default: T.unsafe(nil), **options); end
|
397
|
+
|
398
|
+
# Gets the number of rules in the list.
|
399
|
+
#
|
400
|
+
# @return [Integer]
|
401
|
+
def size; end
|
402
|
+
|
403
|
+
protected
|
404
|
+
|
405
|
+
# Returns the value of attribute rules.
|
406
|
+
def rules; end
|
407
|
+
|
408
|
+
private
|
409
|
+
|
410
|
+
def entry_to_rule(entry, value); end
|
411
|
+
def rule_to_entry(rule); end
|
412
|
+
|
413
|
+
# Selects all the rules matching given hostame.
|
414
|
+
#
|
415
|
+
# If `ignore_private` is set to true, the algorithm will skip the rules that are flagged as
|
416
|
+
# private domain. Note that the rules will still be part of the loop.
|
417
|
+
# If you frequently need to access lists ignoring the private domains,
|
418
|
+
# you should create a list that doesn't include these domains setting the
|
419
|
+
# `private_domains: false` option when calling {.parse}.
|
420
|
+
#
|
421
|
+
# Note that this method is currently private, as you should not rely on it. Instead,
|
422
|
+
# the public interface is {#find}. The current internal algorithm allows to return all
|
423
|
+
# matching rules, but different data structures may not be able to do it, and instead would
|
424
|
+
# return only the match. For this reason, you should rely on {#find}.
|
425
|
+
#
|
426
|
+
# @param name [#to_s] the hostname
|
427
|
+
# @param ignore_private [Boolean]
|
428
|
+
# @return [Array<PublicSuffix::Rule::*>]
|
429
|
+
def select(name, ignore_private: T.unsafe(nil)); end
|
430
|
+
|
431
|
+
class << self
|
432
|
+
# Gets the default rule list.
|
433
|
+
#
|
434
|
+
# Initializes a new {PublicSuffix::List} parsing the content
|
435
|
+
# of {PublicSuffix::List.default_list_content}, if required.
|
436
|
+
#
|
437
|
+
# @return [PublicSuffix::List]
|
438
|
+
def default(**options); end
|
439
|
+
|
440
|
+
# Sets the default rule list to +value+.
|
441
|
+
#
|
442
|
+
# @param value [PublicSuffix::List] the new list
|
443
|
+
# @return [PublicSuffix::List]
|
444
|
+
def default=(value); end
|
445
|
+
|
446
|
+
# Parse given +input+ treating the content as Public Suffix List.
|
447
|
+
#
|
448
|
+
# See http://publicsuffix.org/format/ for more details about input format.
|
449
|
+
#
|
450
|
+
# @param input [#each_line] the list to parse
|
451
|
+
# @param private_domains [Boolean] whether to ignore the private domains section
|
452
|
+
# @return [PublicSuffix::List]
|
453
|
+
def parse(input, private_domains: T.unsafe(nil)); end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
PublicSuffix::List::DEFAULT_LIST_PATH = T.let(T.unsafe(nil), String)
|
458
|
+
|
459
|
+
# A Rule is a special object which holds a single definition
|
460
|
+
# of the Public Suffix List.
|
461
|
+
#
|
462
|
+
# There are 3 types of rules, each one represented by a specific
|
463
|
+
# subclass within the +PublicSuffix::Rule+ namespace.
|
464
|
+
#
|
465
|
+
# To create a new Rule, use the {PublicSuffix::Rule#factory} method.
|
466
|
+
#
|
467
|
+
# PublicSuffix::Rule.factory("ar")
|
468
|
+
# # => #<PublicSuffix::Rule::Normal>
|
469
|
+
module PublicSuffix::Rule
|
470
|
+
class << self
|
471
|
+
# The default rule to use if no rule match.
|
472
|
+
#
|
473
|
+
# The default rule is "*". From https://publicsuffix.org/list/:
|
474
|
+
#
|
475
|
+
# > If no rules match, the prevailing rule is "*".
|
476
|
+
#
|
477
|
+
# @return [PublicSuffix::Rule::Wildcard] The default rule.
|
478
|
+
def default; end
|
479
|
+
|
480
|
+
# Takes the +name+ of the rule, detects the specific rule class
|
481
|
+
# and creates a new instance of that class.
|
482
|
+
# The +name+ becomes the rule +value+.
|
483
|
+
#
|
484
|
+
# @example Creates a Normal rule
|
485
|
+
# PublicSuffix::Rule.factory("ar")
|
486
|
+
# # => #<PublicSuffix::Rule::Normal>
|
487
|
+
# @example Creates a Wildcard rule
|
488
|
+
# PublicSuffix::Rule.factory("*.ar")
|
489
|
+
# # => #<PublicSuffix::Rule::Wildcard>
|
490
|
+
# @example Creates an Exception rule
|
491
|
+
# PublicSuffix::Rule.factory("!congresodelalengua3.ar")
|
492
|
+
# # => #<PublicSuffix::Rule::Exception>
|
493
|
+
# @param content [#to_s] the content of the rule
|
494
|
+
# @return [PublicSuffix::Rule::*] A rule instance.
|
495
|
+
def factory(content, private: T.unsafe(nil)); end
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
# = Abstract rule class
|
500
|
+
#
|
501
|
+
# This represent the base class for a Rule definition
|
502
|
+
# in the {Public Suffix List}[https://publicsuffix.org].
|
503
|
+
#
|
504
|
+
# This is intended to be an Abstract class
|
505
|
+
# and you shouldn't create a direct instance. The only purpose
|
506
|
+
# of this class is to expose a common interface
|
507
|
+
# for all the available subclasses.
|
508
|
+
#
|
509
|
+
# * {PublicSuffix::Rule::Normal}
|
510
|
+
# * {PublicSuffix::Rule::Exception}
|
511
|
+
# * {PublicSuffix::Rule::Wildcard}
|
512
|
+
#
|
513
|
+
# ## Properties
|
514
|
+
#
|
515
|
+
# A rule is composed by 4 properties:
|
516
|
+
#
|
517
|
+
# value - A normalized version of the rule name.
|
518
|
+
# The normalization process depends on rule tpe.
|
519
|
+
#
|
520
|
+
# Here's an example
|
521
|
+
#
|
522
|
+
# PublicSuffix::Rule.factory("*.google.com")
|
523
|
+
# #<PublicSuffix::Rule::Wildcard:0x1015c14b0
|
524
|
+
# @value="google.com"
|
525
|
+
# >
|
526
|
+
#
|
527
|
+
# ## Rule Creation
|
528
|
+
#
|
529
|
+
# The best way to create a new rule is passing the rule name
|
530
|
+
# to the <tt>PublicSuffix::Rule.factory</tt> method.
|
531
|
+
#
|
532
|
+
# PublicSuffix::Rule.factory("com")
|
533
|
+
# # => PublicSuffix::Rule::Normal
|
534
|
+
#
|
535
|
+
# PublicSuffix::Rule.factory("*.com")
|
536
|
+
# # => PublicSuffix::Rule::Wildcard
|
537
|
+
#
|
538
|
+
# This method will detect the rule type and create an instance
|
539
|
+
# from the proper rule class.
|
540
|
+
#
|
541
|
+
# ## Rule Usage
|
542
|
+
#
|
543
|
+
# A rule describes the composition of a domain name and explains how to tokenize
|
544
|
+
# the name into tld, sld and trd.
|
545
|
+
#
|
546
|
+
# To use a rule, you first need to be sure the name you want to tokenize
|
547
|
+
# can be handled by the current rule.
|
548
|
+
# You can use the <tt>#match?</tt> method.
|
549
|
+
#
|
550
|
+
# rule = PublicSuffix::Rule.factory("com")
|
551
|
+
#
|
552
|
+
# rule.match?("google.com")
|
553
|
+
# # => true
|
554
|
+
#
|
555
|
+
# rule.match?("google.com")
|
556
|
+
# # => false
|
557
|
+
#
|
558
|
+
# Rule order is significant. A name can match more than one rule.
|
559
|
+
# See the {Public Suffix Documentation}[http://publicsuffix.org/format/]
|
560
|
+
# to learn more about rule priority.
|
561
|
+
#
|
562
|
+
# When you have the right rule, you can use it to tokenize the domain name.
|
563
|
+
#
|
564
|
+
# rule = PublicSuffix::Rule.factory("com")
|
565
|
+
#
|
566
|
+
# rule.decompose("google.com")
|
567
|
+
# # => ["google", "com"]
|
568
|
+
#
|
569
|
+
# rule.decompose("www.google.com")
|
570
|
+
# # => ["www.google", "com"]
|
571
|
+
#
|
572
|
+
# @abstract
|
573
|
+
class PublicSuffix::Rule::Base
|
574
|
+
# Initializes a new rule.
|
575
|
+
#
|
576
|
+
# @param value [String]
|
577
|
+
# @param private [Boolean]
|
578
|
+
# @return [Base] a new instance of Base
|
579
|
+
def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
|
580
|
+
|
581
|
+
# Checks whether this rule is equal to <tt>other</tt>.
|
582
|
+
#
|
583
|
+
# @param other [PublicSuffix::Rule::*] The rule to compare
|
584
|
+
# @return [Boolean] true if this rule and other are instances of the same class
|
585
|
+
# and has the same value, false otherwise.
|
586
|
+
def ==(other); end
|
587
|
+
|
588
|
+
# @abstract
|
589
|
+
# @param domain [#to_s] The domain name to decompose
|
590
|
+
# @raise [NotImplementedError]
|
591
|
+
# @return [Array<String, nil>]
|
592
|
+
def decompose(*_arg0); end
|
593
|
+
|
594
|
+
# Checks whether this rule is equal to <tt>other</tt>.
|
595
|
+
#
|
596
|
+
# @param other [PublicSuffix::Rule::*] The rule to compare
|
597
|
+
# @return [Boolean] true if this rule and other are instances of the same class
|
598
|
+
# and has the same value, false otherwise.
|
599
|
+
def eql?(other); end
|
600
|
+
|
601
|
+
# @return [String] the length of the rule
|
602
|
+
def length; end
|
603
|
+
|
604
|
+
# Checks if this rule matches +name+.
|
605
|
+
#
|
606
|
+
# A domain name is said to match a rule if and only if
|
607
|
+
# all of the following conditions are met:
|
608
|
+
#
|
609
|
+
# - When the domain and rule are split into corresponding labels,
|
610
|
+
# that the domain contains as many or more labels than the rule.
|
611
|
+
# - Beginning with the right-most labels of both the domain and the rule,
|
612
|
+
# and continuing for all labels in the rule, one finds that for every pair,
|
613
|
+
# either they are identical, or that the label from the rule is "*".
|
614
|
+
#
|
615
|
+
# @example
|
616
|
+
# PublicSuffix::Rule.factory("com").match?("example.com")
|
617
|
+
# # => true
|
618
|
+
# PublicSuffix::Rule.factory("com").match?("example.net")
|
619
|
+
# # => false
|
620
|
+
# @param name [String] the domain name to check
|
621
|
+
# @return [Boolean]
|
622
|
+
# @see https://publicsuffix.org/list/
|
623
|
+
def match?(name); end
|
624
|
+
|
625
|
+
# @abstract
|
626
|
+
# @raise [NotImplementedError]
|
627
|
+
def parts; end
|
628
|
+
|
629
|
+
# @return [Boolean] true if the rule is a private domain
|
630
|
+
def private; end
|
631
|
+
|
632
|
+
# @return [String] the rule definition
|
633
|
+
def value; end
|
634
|
+
|
635
|
+
class << self
|
636
|
+
# Initializes a new rule from the content.
|
637
|
+
#
|
638
|
+
# @param content [String] the content of the rule
|
639
|
+
# @param private [Boolean]
|
640
|
+
def build(content, private: T.unsafe(nil)); end
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
644
|
+
# @api internal
|
645
|
+
class PublicSuffix::Rule::Entry < ::Struct
|
646
|
+
# Returns the value of attribute length
|
647
|
+
#
|
648
|
+
# @return [Object] the current value of length
|
649
|
+
def length; end
|
650
|
+
|
651
|
+
# Sets the attribute length
|
652
|
+
#
|
653
|
+
# @param value [Object] the value to set the attribute length to.
|
654
|
+
# @return [Object] the newly set value
|
655
|
+
def length=(_); end
|
656
|
+
|
657
|
+
# Returns the value of attribute private
|
658
|
+
#
|
659
|
+
# @return [Object] the current value of private
|
660
|
+
def private; end
|
661
|
+
|
662
|
+
# Sets the attribute private
|
663
|
+
#
|
664
|
+
# @param value [Object] the value to set the attribute private to.
|
665
|
+
# @return [Object] the newly set value
|
666
|
+
def private=(_); end
|
667
|
+
|
668
|
+
# Returns the value of attribute type
|
669
|
+
#
|
670
|
+
# @return [Object] the current value of type
|
671
|
+
def type; end
|
672
|
+
|
673
|
+
# Sets the attribute type
|
674
|
+
#
|
675
|
+
# @param value [Object] the value to set the attribute type to.
|
676
|
+
# @return [Object] the newly set value
|
677
|
+
def type=(_); end
|
678
|
+
|
679
|
+
class << self
|
680
|
+
def [](*_arg0); end
|
681
|
+
def inspect; end
|
682
|
+
def members; end
|
683
|
+
def new(*_arg0); end
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
# Exception represents an exception rule (e.g. !parliament.uk).
|
688
|
+
class PublicSuffix::Rule::Exception < ::PublicSuffix::Rule::Base
|
689
|
+
# Decomposes the domain name according to rule properties.
|
690
|
+
#
|
691
|
+
# @param domain [#to_s] The domain name to decompose
|
692
|
+
# @return [Array<String>] The array with [trd + sld, tld].
|
693
|
+
def decompose(domain); end
|
694
|
+
|
695
|
+
# dot-split rule value and returns all rule parts
|
696
|
+
# in the order they appear in the value.
|
697
|
+
# The leftmost label is not considered a label.
|
698
|
+
#
|
699
|
+
# See http://publicsuffix.org/format/:
|
700
|
+
# If the prevailing rule is a exception rule,
|
701
|
+
# modify it by removing the leftmost label.
|
702
|
+
#
|
703
|
+
# @return [Array<String>]
|
704
|
+
def parts; end
|
705
|
+
|
706
|
+
# Gets the original rule definition.
|
707
|
+
#
|
708
|
+
# @return [String] The rule definition.
|
709
|
+
def rule; end
|
710
|
+
|
711
|
+
class << self
|
712
|
+
# Initializes a new rule from the content.
|
713
|
+
#
|
714
|
+
# @param content [#to_s] the content of the rule
|
715
|
+
# @param private [Boolean]
|
716
|
+
def build(content, private: T.unsafe(nil)); end
|
717
|
+
end
|
718
|
+
end
|
719
|
+
|
720
|
+
# Normal represents a standard rule (e.g. com).
|
721
|
+
class PublicSuffix::Rule::Normal < ::PublicSuffix::Rule::Base
|
722
|
+
# Decomposes the domain name according to rule properties.
|
723
|
+
#
|
724
|
+
# @param domain [#to_s] The domain name to decompose
|
725
|
+
# @return [Array<String>] The array with [trd + sld, tld].
|
726
|
+
def decompose(domain); end
|
727
|
+
|
728
|
+
# dot-split rule value and returns all rule parts
|
729
|
+
# in the order they appear in the value.
|
730
|
+
#
|
731
|
+
# @return [Array<String>]
|
732
|
+
def parts; end
|
733
|
+
|
734
|
+
# Gets the original rule definition.
|
735
|
+
#
|
736
|
+
# @return [String] The rule definition.
|
737
|
+
def rule; end
|
738
|
+
end
|
739
|
+
|
740
|
+
# Wildcard represents a wildcard rule (e.g. *.co.uk).
|
741
|
+
class PublicSuffix::Rule::Wildcard < ::PublicSuffix::Rule::Base
|
742
|
+
# Initializes a new rule.
|
743
|
+
#
|
744
|
+
# @param value [String]
|
745
|
+
# @param length [Integer]
|
746
|
+
# @param private [Boolean]
|
747
|
+
# @return [Wildcard] a new instance of Wildcard
|
748
|
+
def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
|
749
|
+
|
750
|
+
# Decomposes the domain name according to rule properties.
|
751
|
+
#
|
752
|
+
# @param domain [#to_s] The domain name to decompose
|
753
|
+
# @return [Array<String>] The array with [trd + sld, tld].
|
754
|
+
def decompose(domain); end
|
755
|
+
|
756
|
+
# dot-split rule value and returns all rule parts
|
757
|
+
# in the order they appear in the value.
|
758
|
+
#
|
759
|
+
# @return [Array<String>]
|
760
|
+
def parts; end
|
761
|
+
|
762
|
+
# Gets the original rule definition.
|
763
|
+
#
|
764
|
+
# @return [String] The rule definition.
|
765
|
+
def rule; end
|
766
|
+
|
767
|
+
class << self
|
768
|
+
# Initializes a new rule from the content.
|
769
|
+
#
|
770
|
+
# @param content [String] the content of the rule
|
771
|
+
# @param private [Boolean]
|
772
|
+
def build(content, private: T.unsafe(nil)); end
|
773
|
+
end
|
774
|
+
end
|
775
|
+
|
776
|
+
PublicSuffix::STAR = T.let(T.unsafe(nil), String)
|
777
|
+
|
778
|
+
# @return [String] The current library version.
|
779
|
+
PublicSuffix::VERSION = T.let(T.unsafe(nil), String)
|