2022-04-12 18:19:36 +00:00
|
|
|
# typed: true
|
|
|
|
|
2021-04-02 06:02:30 +00:00
|
|
|
# DO NOT EDIT MANUALLY
|
|
|
|
# This is an autogenerated file for types exported from the `public_suffix` gem.
|
2021-09-17 19:28:50 +01:00
|
|
|
# Please instead update this file by running `bin/tapioca gem public_suffix`.
|
2021-04-02 06:02:30 +00:00
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# PublicSuffix is a Ruby domain name parser based on the Public Suffix List.
|
|
|
|
#
|
|
|
|
# The [Public Suffix List](https://publicsuffix.org) is a cross-vendor initiative
|
|
|
|
# to provide an accurate list of domain name suffixes.
|
|
|
|
#
|
|
|
|
# The Public Suffix List is an initiative of the Mozilla Project,
|
|
|
|
# but is maintained as a community resource. It is available for use in any software,
|
|
|
|
# but was originally created to meet the needs of browser manufacturers.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#9
|
2021-04-02 06:02:30 +00:00
|
|
|
module PublicSuffix
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# private
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#149
|
2021-04-02 06:02:30 +00:00
|
|
|
def decompose(name, rule); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Attempt to parse the name and returns the domain, if valid.
|
|
|
|
#
|
|
|
|
# This method doesn't raise. Instead, it returns nil if the domain is not valid for whatever reason.
|
|
|
|
#
|
|
|
|
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
|
|
|
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
|
|
|
# @param ignore_private [Boolean]
|
|
|
|
# @return [String]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#140
|
2021-04-02 06:02:30 +00:00
|
|
|
def domain(name, **options); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Pretend we know how to deal with user input.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#164
|
2021-04-02 06:02:30 +00:00
|
|
|
def normalize(name); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Parses +name+ and returns the {PublicSuffix::Domain} instance.
|
|
|
|
#
|
|
|
|
# @example Parse a valid domain
|
|
|
|
# PublicSuffix.parse("google.com")
|
|
|
|
# # => #<PublicSuffix::Domain:0x007fec2e51e588 @sld="google", @tld="com", @trd=nil>
|
|
|
|
# @example Parse a valid subdomain
|
|
|
|
# PublicSuffix.parse("www.google.com")
|
|
|
|
# # => #<PublicSuffix::Domain:0x007fec276d4cf8 @sld="google", @tld="com", @trd="www">
|
|
|
|
# @example Parse a fully qualified domain
|
|
|
|
# PublicSuffix.parse("google.com.")
|
|
|
|
# # => #<PublicSuffix::Domain:0x007fec257caf38 @sld="google", @tld="com", @trd=nil>
|
|
|
|
# @example Parse a fully qualified domain (subdomain)
|
|
|
|
# PublicSuffix.parse("www.google.com.")
|
|
|
|
# # => #<PublicSuffix::Domain:0x007fec27b6bca8 @sld="google", @tld="com", @trd="www">
|
|
|
|
# @example Parse an invalid (unlisted) domain
|
|
|
|
# PublicSuffix.parse("x.yz")
|
|
|
|
# # => #<PublicSuffix::Domain:0x007fec2f49bec0 @sld="x", @tld="yz", @trd=nil>
|
|
|
|
# @example Parse an invalid (unlisted) domain with strict checking (without applying the default * rule)
|
|
|
|
# PublicSuffix.parse("x.yz", default_rule: nil)
|
|
|
|
# # => PublicSuffix::DomainInvalid: `x.yz` is not a valid domain
|
|
|
|
# @example Parse an URL (not supported, only domains)
|
|
|
|
# PublicSuffix.parse("http://www.google.com")
|
|
|
|
# # => PublicSuffix::DomainInvalid: http://www.google.com is not expected to contain a scheme
|
|
|
|
# @param name [#to_s] The domain name or fully qualified domain name to parse.
|
|
|
|
# @param list [PublicSuffix::List] The rule list to search, defaults to the default {PublicSuffix::List}
|
|
|
|
# @param ignore_private [Boolean]
|
|
|
|
# @raise [PublicSuffix::DomainInvalid] If domain is not a valid domain.
|
|
|
|
# @raise [PublicSuffix::DomainNotAllowed] If a rule for +domain+ is found, but the rule doesn't allow +domain+.
|
|
|
|
# @return [PublicSuffix::Domain]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#67
|
2021-04-02 06:02:30 +00:00
|
|
|
def parse(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether +domain+ is assigned and allowed, without actually parsing it.
|
|
|
|
#
|
|
|
|
# This method doesn't care whether domain is a domain or subdomain.
|
|
|
|
# The validation is performed using the default {PublicSuffix::List}.
|
|
|
|
#
|
|
|
|
# @example Validate a valid domain
|
|
|
|
# PublicSuffix.valid?("example.com")
|
|
|
|
# # => true
|
|
|
|
# @example Validate a valid subdomain
|
|
|
|
# PublicSuffix.valid?("www.example.com")
|
|
|
|
# # => true
|
|
|
|
# @example Validate a not-listed domain
|
|
|
|
# PublicSuffix.valid?("example.tldnotlisted")
|
|
|
|
# # => true
|
|
|
|
# @example Validate a not-listed domain with strict checking (without applying the default * rule)
|
|
|
|
# PublicSuffix.valid?("example.tldnotlisted")
|
|
|
|
# # => true
|
|
|
|
# PublicSuffix.valid?("example.tldnotlisted", default_rule: nil)
|
|
|
|
# # => false
|
|
|
|
# @example Validate a fully qualified domain
|
|
|
|
# PublicSuffix.valid?("google.com.")
|
|
|
|
# # => true
|
|
|
|
# PublicSuffix.valid?("www.google.com.")
|
|
|
|
# # => true
|
|
|
|
# @example Check an URL (which is not a valid domain)
|
|
|
|
# PublicSuffix.valid?("http://www.example.com")
|
|
|
|
# # => false
|
|
|
|
# @param name [#to_s] The domain name or fully qualified domain name to validate.
|
|
|
|
# @param ignore_private [Boolean]
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#123
|
2021-04-02 06:02:30 +00:00
|
|
|
def valid?(name, list: T.unsafe(nil), default_rule: T.unsafe(nil), ignore_private: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# source://public_suffix//lib/public_suffix.rb#26
|
2021-04-02 06:02:30 +00:00
|
|
|
PublicSuffix::BANG = T.let(T.unsafe(nil), String)
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# source://public_suffix//lib/public_suffix.rb#25
|
2021-04-02 06:02:30 +00:00
|
|
|
PublicSuffix::DOT = T.let(T.unsafe(nil), String)
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Domain represents a domain name, composed by a TLD, SLD and TRD.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#12
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Domain
|
2023-12-14 15:34:15 +00:00
|
|
|
# Creates and returns a new {PublicSuffix::Domain} instance.
|
|
|
|
#
|
|
|
|
# @example Initialize with a TLD and SLD
|
|
|
|
# PublicSuffix::Domain.new("com", "example")
|
|
|
|
# # => #<PublicSuffix::Domain @tld="com", @trd=nil>
|
|
|
|
# @example Initialize with a TLD
|
|
|
|
# PublicSuffix::Domain.new("com")
|
|
|
|
# # => #<PublicSuffix::Domain @tld="com">
|
|
|
|
# @example Initialize with a TLD, SLD and TRD
|
|
|
|
# PublicSuffix::Domain.new("com", "example", "wwww")
|
|
|
|
# # => #<PublicSuffix::Domain @tld="com", @trd=nil, @sld="example">
|
|
|
|
# @overload initialize
|
|
|
|
# @overload initialize
|
|
|
|
# @overload initialize
|
|
|
|
# @return [Domain] a new instance of Domain
|
|
|
|
# @yield [self] Yields on self.
|
|
|
|
# @yieldparam self [PublicSuffix::Domain] The newly creates instance
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#65
|
2021-04-02 06:02:30 +00:00
|
|
|
def initialize(*args); end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Returns a domain-like representation of this object
|
|
|
|
# if the object is a {#domain?}, <tt>nil</tt> otherwise.
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com").domain
|
|
|
|
# # => nil
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google").domain
|
|
|
|
# # => "google.com"
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").domain
|
|
|
|
# # => "www.google.com"
|
|
|
|
#
|
|
|
|
# This method doesn't validate the input. It handles the domain
|
|
|
|
# as a valid domain name and simply applies the necessary transformations.
|
|
|
|
#
|
|
|
|
# This method returns a FQD, not just the domain part.
|
|
|
|
# To get the domain part, use <tt>#sld</tt> (aka second level domain).
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").domain
|
|
|
|
# # => "google.com"
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").sld
|
|
|
|
# # => "google"
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
# @see #domain?
|
|
|
|
# @see #subdomain
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#137
|
2021-04-02 06:02:30 +00:00
|
|
|
def domain; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether <tt>self</tt> looks like a domain.
|
|
|
|
#
|
|
|
|
# This method doesn't actually validate the domain.
|
|
|
|
# It only checks whether the instance contains
|
|
|
|
# a value for the {#tld} and {#sld} attributes.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com").domain?
|
|
|
|
# # => false
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google").domain?
|
|
|
|
# # => true
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").domain?
|
|
|
|
# # => true
|
|
|
|
#
|
|
|
|
# # This is an invalid domain, but returns true
|
|
|
|
# # because this method doesn't validate the content.
|
|
|
|
# PublicSuffix::Domain.new("com", nil).domain?
|
|
|
|
# # => true
|
|
|
|
# @return [Boolean]
|
|
|
|
# @see #subdomain?
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#198
|
2021-04-02 06:02:30 +00:00
|
|
|
def domain?; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the full domain name.
|
|
|
|
#
|
|
|
|
# @example Gets the domain name of a domain
|
|
|
|
# PublicSuffix::Domain.new("com", "google").name
|
|
|
|
# # => "google.com"
|
|
|
|
# @example Gets the domain name of a subdomain
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").name
|
|
|
|
# # => "www.google.com"
|
|
|
|
# @return [String]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#105
|
2021-04-02 06:02:30 +00:00
|
|
|
def name; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the value of attribute sld.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#33
|
2021-04-02 06:02:30 +00:00
|
|
|
def sld; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns a subdomain-like representation of this object
|
|
|
|
# if the object is a {#subdomain?}, <tt>nil</tt> otherwise.
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com").subdomain
|
|
|
|
# # => nil
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google").subdomain
|
|
|
|
# # => nil
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").subdomain
|
|
|
|
# # => "www.google.com"
|
|
|
|
#
|
|
|
|
# This method doesn't validate the input. It handles the domain
|
|
|
|
# as a valid domain name and simply applies the necessary transformations.
|
|
|
|
#
|
|
|
|
# This method returns a FQD, not just the subdomain part.
|
|
|
|
# To get the subdomain part, use <tt>#trd</tt> (aka third level domain).
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").subdomain
|
|
|
|
# # => "www.google.com"
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").trd
|
|
|
|
# # => "www"
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
# @see #subdomain?
|
|
|
|
# @see #domain
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#169
|
2021-04-02 06:02:30 +00:00
|
|
|
def subdomain; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether <tt>self</tt> looks like a subdomain.
|
|
|
|
#
|
|
|
|
# This method doesn't actually validate the subdomain.
|
|
|
|
# It only checks whether the instance contains
|
|
|
|
# a value for the {#tld}, {#sld} and {#trd} attributes.
|
|
|
|
# If you also want to validate the domain,
|
|
|
|
# use {#valid_subdomain?} instead.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com").subdomain?
|
|
|
|
# # => false
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google").subdomain?
|
|
|
|
# # => false
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("com", "google", "www").subdomain?
|
|
|
|
# # => true
|
|
|
|
#
|
|
|
|
# # This is an invalid domain, but returns true
|
|
|
|
# # because this method doesn't validate the content.
|
|
|
|
# PublicSuffix::Domain.new("com", "example", nil).subdomain?
|
|
|
|
# # => true
|
|
|
|
# @return [Boolean]
|
|
|
|
# @see #domain?
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#229
|
2021-04-02 06:02:30 +00:00
|
|
|
def subdomain?; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the value of attribute tld.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#33
|
2021-04-02 06:02:30 +00:00
|
|
|
def tld; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns an array containing the domain parts.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("google.com").to_a
|
|
|
|
# # => [nil, "google", "com"]
|
|
|
|
#
|
|
|
|
# PublicSuffix::Domain.new("www.google.com").to_a
|
|
|
|
# # => [nil, "google", "com"]
|
|
|
|
# @return [Array<String, nil>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#89
|
2021-04-02 06:02:30 +00:00
|
|
|
def to_a; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns a string representation of this object.
|
|
|
|
#
|
|
|
|
# @return [String]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#73
|
2021-04-02 06:02:30 +00:00
|
|
|
def to_s; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the value of attribute trd.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#33
|
2021-04-02 06:02:30 +00:00
|
|
|
def trd; end
|
|
|
|
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# Splits a string into the labels, that is the dot-separated parts.
|
|
|
|
#
|
|
|
|
# The input is not validated, but it is assumed to be a valid domain name.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# name_to_labels('example.com')
|
|
|
|
# # => ['example', 'com']
|
|
|
|
#
|
|
|
|
# name_to_labels('example.co.uk')
|
|
|
|
# # => ['example', 'co', 'uk']
|
|
|
|
# @param name [String, #to_s] The domain name to split.
|
|
|
|
# @return [Array<String>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/domain.rb#28
|
2021-04-02 06:02:30 +00:00
|
|
|
def name_to_labels(name); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Raised when trying to parse an invalid name.
|
|
|
|
# A name is considered invalid when no rule is found in the definition list.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# PublicSuffix.parse("nic.test")
|
|
|
|
# # => PublicSuffix::DomainInvalid
|
|
|
|
#
|
|
|
|
# PublicSuffix.parse("http://www.nic.it")
|
|
|
|
# # => PublicSuffix::DomainInvalid
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/errors.rb#25
|
2021-09-10 21:21:17 +01:00
|
|
|
class PublicSuffix::DomainInvalid < ::PublicSuffix::Error; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Raised when trying to parse a name that matches a suffix.
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
#
|
|
|
|
# PublicSuffix.parse("nic.do")
|
|
|
|
# # => PublicSuffix::DomainNotAllowed
|
|
|
|
#
|
|
|
|
# PublicSuffix.parse("www.nic.do")
|
|
|
|
# # => PublicSuffix::Domain
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/errors.rb#38
|
2021-09-10 21:21:17 +01:00
|
|
|
class PublicSuffix::DomainNotAllowed < ::PublicSuffix::DomainInvalid; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# source://public_suffix//lib/public_suffix/errors.rb#11
|
2021-09-10 21:21:17 +01:00
|
|
|
class PublicSuffix::Error < ::StandardError; end
|
2021-04-02 06:02:30 +00:00
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# A {PublicSuffix::List} is a collection of one
|
|
|
|
# or more {PublicSuffix::Rule}.
|
|
|
|
#
|
|
|
|
# Given a {PublicSuffix::List},
|
|
|
|
# you can add or remove {PublicSuffix::Rule},
|
|
|
|
# iterate all items in the list or search for the first rule
|
|
|
|
# which matches a specific domain name.
|
|
|
|
#
|
|
|
|
# # Create a new list
|
|
|
|
# list = PublicSuffix::List.new
|
|
|
|
#
|
|
|
|
# # Push two rules to the list
|
|
|
|
# list << PublicSuffix::Rule.factory("it")
|
|
|
|
# list << PublicSuffix::Rule.factory("com")
|
|
|
|
#
|
|
|
|
# # Get the size of the list
|
|
|
|
# list.size
|
|
|
|
# # => 2
|
|
|
|
#
|
|
|
|
# # Search for the rule matching given domain
|
|
|
|
# list.find("example.com")
|
|
|
|
# # => #<PublicSuffix::Rule::Normal>
|
|
|
|
# list.find("example.org")
|
|
|
|
# # => nil
|
|
|
|
#
|
|
|
|
# You can create as many {PublicSuffix::List} you want.
|
|
|
|
# The {PublicSuffix::List.default} rule list is used
|
|
|
|
# to tokenize and validate a domain.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#40
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::List
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes an empty {PublicSuffix::List}.
|
|
|
|
#
|
|
|
|
# @return [List] a new instance of List
|
|
|
|
# @yield [self] Yields on self.
|
|
|
|
# @yieldparam self [PublicSuffix::List] The newly created instance.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#106
|
2021-04-02 06:02:30 +00:00
|
|
|
def initialize; end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Adds the given object to the list and optionally refreshes the rule index.
|
|
|
|
#
|
|
|
|
# @param rule [PublicSuffix::Rule::*] the rule to add to the list
|
|
|
|
# @return [self]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#141
|
2021-04-02 06:02:30 +00:00
|
|
|
def <<(rule); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether two lists are equal.
|
|
|
|
#
|
|
|
|
# List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
|
|
|
|
# {PublicSuffix::List} and each +PublicSuffix::Rule::*+
|
|
|
|
# in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
|
|
|
|
#
|
|
|
|
# @param other [PublicSuffix::List] the List to compare
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#120
|
2021-04-02 06:02:30 +00:00
|
|
|
def ==(other); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Adds the given object to the list and optionally refreshes the rule index.
|
|
|
|
#
|
|
|
|
# @param rule [PublicSuffix::Rule::*] the rule to add to the list
|
|
|
|
# @return [self]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#141
|
2021-04-02 06:02:30 +00:00
|
|
|
def add(rule); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Removes all rules.
|
|
|
|
#
|
|
|
|
# @return [self]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#164
|
2021-04-02 06:02:30 +00:00
|
|
|
def clear; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Gets the default rule.
|
|
|
|
#
|
|
|
|
# @return [PublicSuffix::Rule::*]
|
|
|
|
# @see PublicSuffix::Rule.default_rule
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#226
|
2021-04-02 06:02:30 +00:00
|
|
|
def default_rule; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Iterates each rule in the list.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#128
|
2021-04-02 06:02:30 +00:00
|
|
|
def each(&block); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether the list is empty.
|
|
|
|
#
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#157
|
2021-04-02 06:02:30 +00:00
|
|
|
def empty?; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether two lists are equal.
|
|
|
|
#
|
|
|
|
# List <tt>one</tt> is equal to <tt>two</tt>, if <tt>two</tt> is an instance of
|
|
|
|
# {PublicSuffix::List} and each +PublicSuffix::Rule::*+
|
|
|
|
# in list <tt>one</tt> is available in list <tt>two</tt>, in the same order.
|
|
|
|
#
|
|
|
|
# @param other [PublicSuffix::List] the List to compare
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#120
|
2021-04-02 06:02:30 +00:00
|
|
|
def eql?(other); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Finds and returns the rule corresponding to the longest public suffix for the hostname.
|
|
|
|
#
|
|
|
|
# @param name [#to_s] the hostname
|
|
|
|
# @param default [PublicSuffix::Rule::*] the default rule to return in case no rule matches
|
|
|
|
# @return [PublicSuffix::Rule::*]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#174
|
2021-04-02 06:02:30 +00:00
|
|
|
def find(name, default: T.unsafe(nil), **options); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Gets the number of rules in the list.
|
|
|
|
#
|
|
|
|
# @return [Integer]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#150
|
2021-04-02 06:02:30 +00:00
|
|
|
def size; end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Returns the value of attribute rules.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#233
|
2021-04-02 06:02:30 +00:00
|
|
|
def rules; end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#238
|
2021-04-02 06:02:30 +00:00
|
|
|
def entry_to_rule(entry, value); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#242
|
2021-04-02 06:02:30 +00:00
|
|
|
def rule_to_entry(rule); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Selects all the rules matching given hostame.
|
|
|
|
#
|
|
|
|
# If `ignore_private` is set to true, the algorithm will skip the rules that are flagged as
|
|
|
|
# private domain. Note that the rules will still be part of the loop.
|
|
|
|
# If you frequently need to access lists ignoring the private domains,
|
|
|
|
# you should create a list that doesn't include these domains setting the
|
|
|
|
# `private_domains: false` option when calling {.parse}.
|
|
|
|
#
|
|
|
|
# Note that this method is currently private, as you should not rely on it. Instead,
|
|
|
|
# the public interface is {#find}. The current internal algorithm allows to return all
|
|
|
|
# matching rules, but different data structures may not be able to do it, and instead would
|
|
|
|
# return only the match. For this reason, you should rely on {#find}.
|
|
|
|
#
|
|
|
|
# @param name [#to_s] the hostname
|
|
|
|
# @param ignore_private [Boolean]
|
|
|
|
# @return [Array<PublicSuffix::Rule::*>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#199
|
2021-04-02 06:02:30 +00:00
|
|
|
def select(name, ignore_private: T.unsafe(nil)); end
|
|
|
|
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# Gets the default rule list.
|
|
|
|
#
|
|
|
|
# Initializes a new {PublicSuffix::List} parsing the content
|
|
|
|
# of {PublicSuffix::List.default_list_content}, if required.
|
|
|
|
#
|
|
|
|
# @return [PublicSuffix::List]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#50
|
2021-04-02 06:02:30 +00:00
|
|
|
def default(**options); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Sets the default rule list to +value+.
|
|
|
|
#
|
|
|
|
# @param value [PublicSuffix::List] the new list
|
|
|
|
# @return [PublicSuffix::List]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#58
|
2021-04-02 06:02:30 +00:00
|
|
|
def default=(value); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Parse given +input+ treating the content as Public Suffix List.
|
|
|
|
#
|
|
|
|
# See http://publicsuffix.org/format/ for more details about input format.
|
|
|
|
#
|
|
|
|
# @param input [#each_line] the list to parse
|
|
|
|
# @param private_domains [Boolean] whether to ignore the private domains section
|
|
|
|
# @return [PublicSuffix::List]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#69
|
2021-04-02 06:02:30 +00:00
|
|
|
def parse(input, private_domains: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# source://public_suffix//lib/public_suffix/list.rb#42
|
2021-04-02 06:02:30 +00:00
|
|
|
PublicSuffix::List::DEFAULT_LIST_PATH = T.let(T.unsafe(nil), String)
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# A Rule is a special object which holds a single definition
|
|
|
|
# of the Public Suffix List.
|
|
|
|
#
|
|
|
|
# There are 3 types of rules, each one represented by a specific
|
|
|
|
# subclass within the +PublicSuffix::Rule+ namespace.
|
|
|
|
#
|
|
|
|
# To create a new Rule, use the {PublicSuffix::Rule#factory} method.
|
|
|
|
#
|
|
|
|
# PublicSuffix::Rule.factory("ar")
|
|
|
|
# # => #<PublicSuffix::Rule::Normal>
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#22
|
2021-04-02 06:02:30 +00:00
|
|
|
module PublicSuffix::Rule
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# The default rule to use if no rule match.
|
|
|
|
#
|
|
|
|
# The default rule is "*". From https://publicsuffix.org/list/:
|
|
|
|
#
|
|
|
|
# > If no rules match, the prevailing rule is "*".
|
|
|
|
#
|
|
|
|
# @return [PublicSuffix::Rule::Wildcard] The default rule.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#344
|
2021-04-02 06:02:30 +00:00
|
|
|
def default; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Takes the +name+ of the rule, detects the specific rule class
|
|
|
|
# and creates a new instance of that class.
|
|
|
|
# The +name+ becomes the rule +value+.
|
|
|
|
#
|
|
|
|
# @example Creates a Normal rule
|
|
|
|
# PublicSuffix::Rule.factory("ar")
|
|
|
|
# # => #<PublicSuffix::Rule::Normal>
|
|
|
|
# @example Creates a Wildcard rule
|
|
|
|
# PublicSuffix::Rule.factory("*.ar")
|
|
|
|
# # => #<PublicSuffix::Rule::Wildcard>
|
|
|
|
# @example Creates an Exception rule
|
|
|
|
# PublicSuffix::Rule.factory("!congresodelalengua3.ar")
|
|
|
|
# # => #<PublicSuffix::Rule::Exception>
|
|
|
|
# @param content [#to_s] the content of the rule
|
|
|
|
# @return [PublicSuffix::Rule::*] A rule instance.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#326
|
2021-04-02 06:02:30 +00:00
|
|
|
def factory(content, private: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# = Abstract rule class
|
|
|
|
#
|
|
|
|
# This represent the base class for a Rule definition
|
|
|
|
# in the {Public Suffix List}[https://publicsuffix.org].
|
|
|
|
#
|
|
|
|
# This is intended to be an Abstract class
|
|
|
|
# and you shouldn't create a direct instance. The only purpose
|
|
|
|
# of this class is to expose a common interface
|
|
|
|
# for all the available subclasses.
|
|
|
|
#
|
|
|
|
# * {PublicSuffix::Rule::Normal}
|
|
|
|
# * {PublicSuffix::Rule::Exception}
|
|
|
|
# * {PublicSuffix::Rule::Wildcard}
|
|
|
|
#
|
|
|
|
# ## Properties
|
|
|
|
#
|
|
|
|
# A rule is composed by 4 properties:
|
|
|
|
#
|
|
|
|
# value - A normalized version of the rule name.
|
|
|
|
# The normalization process depends on rule tpe.
|
|
|
|
#
|
|
|
|
# Here's an example
|
|
|
|
#
|
|
|
|
# PublicSuffix::Rule.factory("*.google.com")
|
|
|
|
# #<PublicSuffix::Rule::Wildcard:0x1015c14b0
|
|
|
|
# @value="google.com"
|
|
|
|
# >
|
|
|
|
#
|
|
|
|
# ## Rule Creation
|
|
|
|
#
|
|
|
|
# The best way to create a new rule is passing the rule name
|
|
|
|
# to the <tt>PublicSuffix::Rule.factory</tt> method.
|
|
|
|
#
|
|
|
|
# PublicSuffix::Rule.factory("com")
|
|
|
|
# # => PublicSuffix::Rule::Normal
|
|
|
|
#
|
|
|
|
# PublicSuffix::Rule.factory("*.com")
|
|
|
|
# # => PublicSuffix::Rule::Wildcard
|
|
|
|
#
|
|
|
|
# This method will detect the rule type and create an instance
|
|
|
|
# from the proper rule class.
|
|
|
|
#
|
|
|
|
# ## Rule Usage
|
|
|
|
#
|
|
|
|
# A rule describes the composition of a domain name and explains how to tokenize
|
|
|
|
# the name into tld, sld and trd.
|
|
|
|
#
|
|
|
|
# To use a rule, you first need to be sure the name you want to tokenize
|
|
|
|
# can be handled by the current rule.
|
|
|
|
# You can use the <tt>#match?</tt> method.
|
|
|
|
#
|
|
|
|
# rule = PublicSuffix::Rule.factory("com")
|
|
|
|
#
|
|
|
|
# rule.match?("google.com")
|
|
|
|
# # => true
|
|
|
|
#
|
|
|
|
# rule.match?("google.com")
|
|
|
|
# # => false
|
|
|
|
#
|
|
|
|
# Rule order is significant. A name can match more than one rule.
|
|
|
|
# See the {Public Suffix Documentation}[http://publicsuffix.org/format/]
|
|
|
|
# to learn more about rule priority.
|
|
|
|
#
|
|
|
|
# When you have the right rule, you can use it to tokenize the domain name.
|
|
|
|
#
|
|
|
|
# rule = PublicSuffix::Rule.factory("com")
|
|
|
|
#
|
|
|
|
# rule.decompose("google.com")
|
|
|
|
# # => ["google", "com"]
|
|
|
|
#
|
|
|
|
# rule.decompose("www.google.com")
|
|
|
|
# # => ["www.google", "com"]
|
|
|
|
#
|
|
|
|
# @abstract
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#102
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Rule::Base
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes a new rule.
|
|
|
|
#
|
|
|
|
# @param value [String]
|
|
|
|
# @param private [Boolean]
|
|
|
|
# @return [Base] a new instance of Base
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#126
|
2021-04-02 06:02:30 +00:00
|
|
|
def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Checks whether this rule is equal to <tt>other</tt>.
|
|
|
|
#
|
|
|
|
# @param other [PublicSuffix::Rule::*] The rule to compare
|
|
|
|
# @return [Boolean] true if this rule and other are instances of the same class
|
|
|
|
# and has the same value, false otherwise.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#137
|
2021-04-02 06:02:30 +00:00
|
|
|
def ==(other); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @abstract
|
|
|
|
# @param domain [#to_s] The domain name to decompose
|
|
|
|
# @raise [NotImplementedError]
|
|
|
|
# @return [Array<String, nil>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#180
|
2021-04-02 06:02:30 +00:00
|
|
|
def decompose(*_arg0); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks whether this rule is equal to <tt>other</tt>.
|
|
|
|
#
|
|
|
|
# @param other [PublicSuffix::Rule::*] The rule to compare
|
|
|
|
# @return [Boolean] true if this rule and other are instances of the same class
|
|
|
|
# and has the same value, false otherwise.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#137
|
2021-04-02 06:02:30 +00:00
|
|
|
def eql?(other); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @return [String] the length of the rule
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#108
|
2021-04-02 06:02:30 +00:00
|
|
|
def length; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Checks if this rule matches +name+.
|
|
|
|
#
|
|
|
|
# A domain name is said to match a rule if and only if
|
|
|
|
# all of the following conditions are met:
|
|
|
|
#
|
|
|
|
# - When the domain and rule are split into corresponding labels,
|
|
|
|
# that the domain contains as many or more labels than the rule.
|
|
|
|
# - Beginning with the right-most labels of both the domain and the rule,
|
|
|
|
# and continuing for all labels in the rule, one finds that for every pair,
|
|
|
|
# either they are identical, or that the label from the rule is "*".
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# PublicSuffix::Rule.factory("com").match?("example.com")
|
|
|
|
# # => true
|
|
|
|
# PublicSuffix::Rule.factory("com").match?("example.net")
|
|
|
|
# # => false
|
|
|
|
# @param name [String] the domain name to check
|
|
|
|
# @return [Boolean]
|
|
|
|
# @see https://publicsuffix.org/list/
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#163
|
2021-04-02 06:02:30 +00:00
|
|
|
def match?(name); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @abstract
|
|
|
|
# @raise [NotImplementedError]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#173
|
2021-04-02 06:02:30 +00:00
|
|
|
def parts; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @return [Boolean] true if the rule is a private domain
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#111
|
2021-04-02 06:02:30 +00:00
|
|
|
def private; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @return [String] the rule definition
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#105
|
2021-04-02 06:02:30 +00:00
|
|
|
def value; end
|
|
|
|
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes a new rule from the content.
|
|
|
|
#
|
|
|
|
# @param content [String] the content of the rule
|
|
|
|
# @param private [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#118
|
2021-04-02 06:02:30 +00:00
|
|
|
def build(content, private: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# @api internal
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#25
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Rule::Entry < ::Struct
|
2023-12-14 15:34:15 +00:00
|
|
|
# Returns the value of attribute length
|
|
|
|
#
|
|
|
|
# @return [Object] the current value of length
|
2021-04-02 06:02:30 +00:00
|
|
|
def length; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Sets the attribute length
|
|
|
|
#
|
|
|
|
# @param value [Object] the value to set the attribute length to.
|
|
|
|
# @return [Object] the newly set value
|
2021-04-02 06:02:30 +00:00
|
|
|
def length=(_); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the value of attribute private
|
|
|
|
#
|
|
|
|
# @return [Object] the current value of private
|
2021-04-02 06:02:30 +00:00
|
|
|
def private; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Sets the attribute private
|
|
|
|
#
|
|
|
|
# @param value [Object] the value to set the attribute private to.
|
|
|
|
# @return [Object] the newly set value
|
2021-04-02 06:02:30 +00:00
|
|
|
def private=(_); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Returns the value of attribute type
|
|
|
|
#
|
|
|
|
# @return [Object] the current value of type
|
2021-04-02 06:02:30 +00:00
|
|
|
def type; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Sets the attribute type
|
|
|
|
#
|
|
|
|
# @param value [Object] the value to set the attribute type to.
|
|
|
|
# @return [Object] the newly set value
|
2021-04-02 06:02:30 +00:00
|
|
|
def type=(_); end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def [](*_arg0); end
|
|
|
|
def inspect; end
|
2023-12-14 15:34:15 +00:00
|
|
|
def keyword_init?; end
|
2021-04-02 06:02:30 +00:00
|
|
|
def members; end
|
|
|
|
def new(*_arg0); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Exception represents an exception rule (e.g. !parliament.uk).
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#265
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Rule::Exception < ::PublicSuffix::Rule::Base
|
2023-12-14 15:34:15 +00:00
|
|
|
# Decomposes the domain name according to rule properties.
|
|
|
|
#
|
|
|
|
# @param domain [#to_s] The domain name to decompose
|
|
|
|
# @return [Array<String>] The array with [trd + sld, tld].
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#286
|
2021-04-02 06:02:30 +00:00
|
|
|
def decompose(domain); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# dot-split rule value and returns all rule parts
|
|
|
|
# in the order they appear in the value.
|
|
|
|
# The leftmost label is not considered a label.
|
|
|
|
#
|
|
|
|
# See http://publicsuffix.org/format/:
|
|
|
|
# If the prevailing rule is a exception rule,
|
|
|
|
# modify it by removing the leftmost label.
|
|
|
|
#
|
|
|
|
# @return [Array<String>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#301
|
2021-04-02 06:02:30 +00:00
|
|
|
def parts; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Gets the original rule definition.
|
|
|
|
#
|
|
|
|
# @return [String] The rule definition.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#278
|
2021-04-02 06:02:30 +00:00
|
|
|
def rule; end
|
|
|
|
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes a new rule from the content.
|
|
|
|
#
|
|
|
|
# @param content [#to_s] the content of the rule
|
|
|
|
# @param private [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#271
|
2021-04-02 06:02:30 +00:00
|
|
|
def build(content, private: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Normal represents a standard rule (e.g. com).
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#187
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Rule::Normal < ::PublicSuffix::Rule::Base
|
2023-12-14 15:34:15 +00:00
|
|
|
# Decomposes the domain name according to rule properties.
|
|
|
|
#
|
|
|
|
# @param domain [#to_s] The domain name to decompose
|
|
|
|
# @return [Array<String>] The array with [trd + sld, tld].
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#200
|
2021-04-02 06:02:30 +00:00
|
|
|
def decompose(domain); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# dot-split rule value and returns all rule parts
|
|
|
|
# in the order they appear in the value.
|
|
|
|
#
|
|
|
|
# @return [Array<String>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#210
|
2021-04-02 06:02:30 +00:00
|
|
|
def parts; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Gets the original rule definition.
|
|
|
|
#
|
|
|
|
# @return [String] The rule definition.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#192
|
2021-04-02 06:02:30 +00:00
|
|
|
def rule; end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Wildcard represents a wildcard rule (e.g. *.co.uk).
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#217
|
2021-04-02 06:02:30 +00:00
|
|
|
class PublicSuffix::Rule::Wildcard < ::PublicSuffix::Rule::Base
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes a new rule.
|
|
|
|
#
|
|
|
|
# @param value [String]
|
|
|
|
# @param length [Integer]
|
|
|
|
# @param private [Boolean]
|
|
|
|
# @return [Wildcard] a new instance of Wildcard
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#232
|
2021-04-02 06:02:30 +00:00
|
|
|
def initialize(value:, length: T.unsafe(nil), private: T.unsafe(nil)); end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# Decomposes the domain name according to rule properties.
|
|
|
|
#
|
|
|
|
# @param domain [#to_s] The domain name to decompose
|
|
|
|
# @return [Array<String>] The array with [trd + sld, tld].
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#248
|
2021-04-02 06:02:30 +00:00
|
|
|
def decompose(domain); end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# dot-split rule value and returns all rule parts
|
|
|
|
# in the order they appear in the value.
|
|
|
|
#
|
|
|
|
# @return [Array<String>]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#258
|
2021-04-02 06:02:30 +00:00
|
|
|
def parts; end
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# Gets the original rule definition.
|
|
|
|
#
|
|
|
|
# @return [String] The rule definition.
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#240
|
2021-04-02 06:02:30 +00:00
|
|
|
def rule; end
|
|
|
|
|
|
|
|
class << self
|
2023-12-14 15:34:15 +00:00
|
|
|
# Initializes a new rule from the content.
|
|
|
|
#
|
|
|
|
# @param content [String] the content of the rule
|
|
|
|
# @param private [Boolean]
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/rule.rb#223
|
2021-04-02 06:02:30 +00:00
|
|
|
def build(content, private: T.unsafe(nil)); end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-12-14 15:34:15 +00:00
|
|
|
# source://public_suffix//lib/public_suffix.rb#27
|
2021-04-02 06:02:30 +00:00
|
|
|
PublicSuffix::STAR = T.let(T.unsafe(nil), String)
|
2023-12-14 15:34:15 +00:00
|
|
|
|
|
|
|
# @return [String] the current library version
|
|
|
|
#
|
|
|
|
# source://public_suffix//lib/public_suffix/version.rb#12
|
2021-04-02 06:02:30 +00:00
|
|
|
PublicSuffix::VERSION = T.let(T.unsafe(nil), String)
|