class PublicSuffix::Rule::Normal
Normal
represents a standard rule (e.g. com).
Public Instance Methods
Decomposes the domain name according to rule properties.
@param domain [#to_s] The domain name to decompose @return [Array<String>] The array with [trd + sld, tld].
# File lib/public_suffix/rule.rb, line 200 def decompose(domain) suffix = parts.join('\.') matches = domain.to_s.match(/^(.*)\.(#{suffix})$/) matches ? matches[1..2] : [nil, nil] end
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 210 def parts @value.split(DOT) end
Gets the original rule definition.
@return [String] The rule definition.
# File lib/public_suffix/rule.rb, line 192 def rule value end