Class: Ronin::Support::Network::PublicSuffix::Suffix Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ronin/support/network/public_suffix/suffix.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents a suffix from the public suffix list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type: :icann) ⇒ Suffix

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initializes the suffix.

Parameters:

  • name (String)
  • type (:icann, :private) (defaults to: :icann)

    Indictages whether the suffix is an official ICANN domain or a private domain suffix.



49
50
51
52
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 49

def initialize(name, type: :icann)
  @name = name
  @type = type
end

Instance Attribute Details

#nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The suffix name.

Returns:



33
34
35
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 33

def name
  @name
end

#type:icann, :private (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The suffix type.

Returns:

  • (:icann, :private)


38
39
40
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 38

def type
  @type
end

Instance Method Details

#==(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compares the suffix to another object.

Parameters:

  • other (Object)

    The other object to compare to.

Returns:

  • (Boolean)


98
99
100
101
102
# 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?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Indicates whether the suffix is an ICANN domain.

Returns:

  • (Boolean)


59
60
61
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 59

def icann?
  @type == :icann
end

#non_wildcard?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Determines if the suffix does not contain a * wildcard.

Returns:

  • (Boolean)


86
87
88
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 86

def non_wildcard?
  !wildcard?
end

#private?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Indicates whether the suffix is a private domain.

Returns:

  • (Boolean)


68
69
70
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 68

def private?
  @type == :private
end

#to_sString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts the suffix to a String.

Returns:

  • (String)

    The suffix name.



110
111
112
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 110

def to_s
  @name
end

#wildcard?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Determines if the suffix contians a * wildcard.

Returns:

  • (Boolean)


77
78
79
# File 'lib/ronin/support/network/public_suffix/suffix.rb', line 77

def wildcard?
  @name.include?('*')
end