class PublicSuffix::Rule::Exception

Exception represents an exception rule (e.g. !parliament.uk).

Public Class Methods

Initializes a new rule from the content.

@param content [#to_s] the content of the rule @param private [Boolean]

# File lib/public_suffix/rule.rb, line 293
def self.build(content, private: false)
  new(value: content.to_s[1..], private: private)
end

Public Instance Methods

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 publicsuffix.org/format/: If the prevailing rule is a exception rule, modify it by removing the leftmost label.

@return [Array<String>]

# File lib/public_suffix/rule.rb, line 313
def parts
  @value.split(DOT)[1..]
end

Gets the original rule definition.

@return [String] The rule definition.

# File lib/public_suffix/rule.rb, line 300
def rule
  BANG + value
end