class Ronin::Support::Network::PublicSuffix::Suffix

Represents a suffix from the public suffix list.

@api private

Attributes

name[R]

The suffix name.

@return [String]

type[R]

The suffix type.

@return [:icann, :private]

Public Class Methods

new(name, type: :icann) click to toggle source

Initializes the suffix.

@param [String] name

@param [:icann, :private] type

Indictages whether the suffix is an official ICANN domain or a
private domain suffix.
# File lib/ronin/support/network/public_suffix/suffix.rb, line 49
def initialize(name, type: :icann)
  @name = name
  @type = type
end

Public Instance Methods

==(other) click to toggle source

Compares the suffix to another object.

@param [Object] other

The other object to compare to.

@return [Boolean]

# File lib/ronin/support/network/public_suffix/suffix.rb, line 98
def ==(other)
  self.class == other.class &&
    @name == other.name &&
    @type == other.type
end
icann?() click to toggle source

Indicates whether the suffix is an ICANN domain.

@return [Boolean]

# File lib/ronin/support/network/public_suffix/suffix.rb, line 59
def icann?
  @type == :icann
end
non_wildcard?() click to toggle source

Determines if the suffix does not contain a ‘*` wildcard.

@return [Boolean]

# File lib/ronin/support/network/public_suffix/suffix.rb, line 86
def non_wildcard?
  !wildcard?
end
private?() click to toggle source

Indicates whether the suffix is a private domain.

@return [Boolean]

# File lib/ronin/support/network/public_suffix/suffix.rb, line 68
def private?
  @type == :private
end
to_s() click to toggle source

Converts the suffix to a String.

@return [String]

The suffix name.
# File lib/ronin/support/network/public_suffix/suffix.rb, line 110
def to_s
  @name
end
wildcard?() click to toggle source

Determines if the suffix contians a ‘*` wildcard.

@return [Boolean]

# File lib/ronin/support/network/public_suffix/suffix.rb, line 77
def wildcard?
  @name.include?('*')
end