class Ronin::Support::Network::PublicSuffix::SuffixSet
A sub-set of public suffixes.
Attributes
The suffixes in the suffix set.
@return [Array<Suffix>, Enumerator::Lazy<Suffix>]
Public Class Methods
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 43 def initialize(suffixes=[]) @suffixes = suffixes end
Initializes the suffix-set.
@param [Enumerator::Lazy<Suffix>] suffixes
The optional suffixes to initialize the suffix set with.
@api private
Public Instance Methods
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 57 def <<(suffix) @suffixes << suffix return self end
Adds a public suffix to the suffix-set.
@param [Suffix] suffix
The suffix String to add.
@return [self]
@api private
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 74 def each(&block) @suffixes.each(&block) end
Enumerates over each suffix within the suffix-set.
@yield [suffix]
If a block is given, it will be passed each suffix in the list.
@yieldparam [Suffix] suffix
A domain suffix in the list.
@return [Enumerator]
If no block is given, an Enumerator object will be returned.
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 97 def icann SuffixSet.new(lazy.select(&:icann?)) end
Selects all ICANN suffixes.
@return [SuffixSet]
The new sub-set of suffixes.
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 136 def length @suffixes.length end
The number of suffixes within the suffix-set.
@return [Integer]
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 127 def non_wildcards SuffixSet.new(lazy.select(&:non_wildcard?)) end
Selects all non-wildcard suffixes.
@return [SuffixSet]
The new sub-set of suffixes.
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 107 def private SuffixSet.new(lazy.select(&:private?)) end
Selects all private suffixes.
@return [SuffixSet]
The new sub-set of suffixes.
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 145 def to_a @suffixes.to_a end
Converts the suffix-set to an Array
of suffixes.
@return [Array<Suffix>]
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 87 def type(type) SuffixSet.new(lazy.select { |suffix| suffix.type == type }) end
Selects all suffixes with the matching type.
@param [:icann, :private] type
The type to filter by.
@return [SuffixSet]
The new sub-set of suffixes.
Source
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 117 def wildcards SuffixSet.new(lazy.select(&:wildcard?)) end
Selects all wildcard suffixes.
@return [SuffixSet]
The new sub-set of suffixes.