class PublicSuffix::Rule::Exception
Exception represents an exception rule (e.g. !parliament.uk).
def self.build(content, private: false)
-
private
(Boolean
) -- -
content
(#to_s
) -- the content of the rule
def self.build(content, private: false) new(value: content.to_s[1..], private: private) end
def decompose(domain)
-
(Array
- The array with [trd + sld, tld].)
Parameters:
-
domain
(#to_s
) -- The domain name to decompose
def decompose(domain) suffix = parts.join('\.') matches = domain.to_s.match(/^(.*)\.(#{suffix})$/) matches ? matches[1..2] : [nil, nil] end
def parts
-
(Array
-)
def parts @value.split(DOT)[1..] end
def rule
-
(String)
- The rule definition.
def rule BANG + value end