PublicSuffix::Rule::Normal

Public Class Methods

new(name) click to toggle source

Initializes a new rule with name.

@param [String] name

The name of this rule.
# File lib/public_suffix/rule.rb, line 264
def initialize(name)
  super(name, name)
end

Public Instance Methods

decompose(domain) click to toggle source

Decomposes the domain according to rule properties.

@param [String, to_s] domain

The domain name to decompose.

@return [Array<String>]

The array with [trd + sld, tld].
# File lib/public_suffix/rule.rb, line 284
def decompose(domain)
  domain.to_s.chomp(".") =~ /^(.*)\.(#{parts.join('\.')})$/
  [$1, $2]
end
parts() click to toggle source

dot-split rule value and returns all rule parts in the order they appear in the value.

@return [Array<String>]

# File lib/public_suffix/rule.rb, line 272
def parts
  @parts ||= @value.split(".")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.