Class: PublicSuffix::Rule::Exception
- Defined in:
- lib/public_suffix/rule.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#decompose(domain) ⇒ Array<String>
Decomposes the domain according to rule properties.
-
#initialize(name) ⇒ Exception
constructor
Initializes a new rule with
name
. -
#parts ⇒ Array<String>
dot-split rule value and returns all rule parts in the order they appear in the value.
Methods inherited from Base
#==, #allow?, #length, #match?, #type, type
Constructor Details
#initialize(name) ⇒ Exception
Initializes a new rule with name
.
322 323 324 |
# File 'lib/public_suffix/rule.rb', line 322 def initialize(name) super(name, name.to_s[1..-1]) end |
Instance Method Details
#decompose(domain) ⇒ Array<String>
Decomposes the domain according to rule properties.
347 348 349 350 |
# File 'lib/public_suffix/rule.rb', line 347 def decompose(domain) domain.to_s.chomp(".") =~ /^(.*)\.(#{parts.join('\.')})$/ [$1, $2] end |
#parts ⇒ Array<String>
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.
335 336 337 |
# File 'lib/public_suffix/rule.rb', line 335 def parts @parts ||= @value.split(".")[1..-1] end |