Class: Ronin::Port

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/ronin/port.rb

Overview

Represents a TCP or UDP port.

Direct Known Subclasses

TCPPort, UDPPort

Instance Method Summary collapse

Methods included from Model

included

Instance Method Details

#inspectString

Inspects the port.

Returns:

  • (String)

    The inspected port.

Since:

  • 1.0.0



88
89
90
# File 'lib/ronin/port.rb', line 88

def inspect
  "#<#{self.class}: #{self}>"
end

#to_iInteger

Converts the port to an integer.

Returns:

  • (Integer)

    The port number.

Since:

  • 1.0.0



60
61
62
# File 'lib/ronin/port.rb', line 60

def to_i
  self.number.to_i
end

#to_sString

Converts the port to a string.

Returns:

  • (String)

    The port number and protocol.

Since:

  • 1.0.0



74
75
76
# File 'lib/ronin/port.rb', line 74

def to_s
  "#{self.number}/#{self.protocol}"
end