Class: PublicSuffix::Rule::Normal
- 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) ⇒ Normal
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?
Constructor Details
#initialize(name) ⇒ Normal
Initializes a new rule with name
.
264 265 266 |
# File 'lib/public_suffix/rule.rb', line 264 def initialize(name) super(name, name) end |
Instance Method Details
#decompose(domain) ⇒ Array<String>
Decomposes the domain according to rule properties.
284 285 286 287 |
# File 'lib/public_suffix/rule.rb', line 284 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.
272 273 274 |
# File 'lib/public_suffix/rule.rb', line 272 def parts @parts ||= @value.split(".") end |