module PublicSuffix::Rule
A Rule is a special object which holds a single definition of the Public Suffix List.
There are 3 types of ruleas, 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>
Constants
- RULES
Public Class Methods
factory(name)
click to toggle source
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
.
@param [String] name The rule definition.
@return [PublicSuffix::Rule::*] A rule instance.
@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>
# File lib/public_suffix/rule.rb, line 380 def self.factory(name) RULES[name.to_s[0,1]].new(name) end