Module: PublicSuffix::Rule
- Defined in:
- lib/public_suffix/rule.rb
Overview
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 #factory method.
PublicSuffix::Rule.factory("ar")
# => #<PublicSuffix::Rule::Normal>
Defined Under Namespace
Classes: Base, Exception, Normal, Wildcard
Class Method Summary collapse
-
.default ⇒ PublicSuffix::Rule::Wildcard
The default rule to use if no rule match.
-
.factory(content, **options) ⇒ PublicSuffix::Rule::*
Takes the
name
of the rule, detects the specific rule class and creates a new instance of that class.
Class Method Details
.default ⇒ PublicSuffix::Rule::Wildcard
The default rule to use if no rule match.
The default rule is “*”. From publicsuffix.org/list/:
> If no rules match, the prevailing rule is “*”.
359 360 361 |
# File 'lib/public_suffix/rule.rb', line 359 def self.default factory(STAR) end |
.factory(content, **options) ⇒ PublicSuffix::Rule::*
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
.
341 342 343 344 345 346 347 348 349 350 |
# File 'lib/public_suffix/rule.rb', line 341 def self.factory(content, **) case content.to_s[0, 1] when STAR Wildcard when BANG Exception else Normal end.new(content, **) end |