class Ronin::Support::Network::PublicSuffix::SuffixSet

A sub-set of public suffixes.

Attributes

suffixes[R]

The suffixes in the suffix set.

@return [Array<Suffix>, Enumerator::Lazy<Suffix>]

Public Class Methods

new(suffixes=[]) click to toggle source

Initializes the suffix-set.

@param [Enumerator::Lazy<Suffix>] suffixes

The optional suffixes to initialize the suffix set with.

@api private

# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 43
def initialize(suffixes=[])
  @suffixes = suffixes
end

Public Instance Methods

<<(suffix) click to toggle source

Adds a public suffix to the suffix-set.

@param [Suffix] suffix

The suffix String to add.

@return [self]

@api private

# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 57
def <<(suffix)
  @suffixes << suffix
  return self
end
each(&block) click to toggle source

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.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 74
def each(&block)
  @suffixes.each(&block)
end
icann() click to toggle source

Selects all ICANN suffixes.

@return [SuffixSet]

The new sub-set of suffixes.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 97
def icann
  SuffixSet.new(lazy.select(&:icann?))
end
length() click to toggle source

The number of suffixes within the suffix-set.

@return [Integer]

# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 136
def length
  @suffixes.length
end
non_wildcards() click to toggle source

Selects all non-wildcard suffixes.

@return [SuffixSet]

The new sub-set of suffixes.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 127
def non_wildcards
  SuffixSet.new(lazy.select(&:non_wildcard?))
end
private() click to toggle source

Selects all private suffixes.

@return [SuffixSet]

The new sub-set of suffixes.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 107
def private
  SuffixSet.new(lazy.select(&:private?))
end
to_a() click to toggle source

Converts the suffix-set to an Array of suffixes.

@return [Array<Suffix>]

# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 145
def to_a
  @suffixes.to_a
end
type(type) click to toggle source

Selects all suffixes with the matching type.

@param [:icann, :private] type

The type to filter by.

@return [SuffixSet]

The new sub-set of suffixes.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 87
def type(type)
  SuffixSet.new(lazy.select { |suffix| suffix.type == type })
end
wildcards() click to toggle source

Selects all wildcard suffixes.

@return [SuffixSet]

The new sub-set of suffixes.
# File lib/ronin/support/network/public_suffix/suffix_set.rb, line 117
def wildcards
  SuffixSet.new(lazy.select(&:wildcard?))
end