Class: RubyNessus::Version2::Port
- Inherits:
-
Object
- Object
- RubyNessus::Version2::Port
- Defined in:
- lib/ruby-nessus/version2/port.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Port number.
-
#protocol ⇒ Object
readonly
Port Protocol.
-
#service ⇒ Object
readonly
Port Service.
Instance Method Summary collapse
-
#icmp? ⇒ Boolean
Return true if the port protocol is icmp.
-
#initialize(number, service, protocol) ⇒ Port
constructor
Creates A New Port Object.
-
#tcp? ⇒ Boolean
Return true if the port protocol is tcp.
-
#to_s ⇒ String
Return the port as a string.
-
#udp? ⇒ Boolean
Return true if the port protocol is udp.
Constructor Details
#initialize(number, service, protocol) ⇒ Port
Creates A New Port Object
Port.new(number, service, )
25 26 27 28 29 |
# File 'lib/ruby-nessus/version2/port.rb', line 25 def initialize(number, service, protocol) @number = number @service = service @protocol = protocol end |
Instance Attribute Details
#number ⇒ Object (readonly)
Port number
9 10 11 |
# File 'lib/ruby-nessus/version2/port.rb', line 9 def number @number end |
#protocol ⇒ Object (readonly)
Port Protocol
11 12 13 |
# File 'lib/ruby-nessus/version2/port.rb', line 11 def protocol @protocol end |
#service ⇒ Object (readonly)
Port Service
7 8 9 |
# File 'lib/ruby-nessus/version2/port.rb', line 7 def service @service end |
Instance Method Details
#icmp? ⇒ Boolean
Return true if the port protocol is icmp.
57 58 59 |
# File 'lib/ruby-nessus/version2/port.rb', line 57 def icmp? @protocol.to_s == 'icmp' end |
#tcp? ⇒ Boolean
Return true if the port protocol is tcp.
37 38 39 |
# File 'lib/ruby-nessus/version2/port.rb', line 37 def tcp? @protocol.to_s == 'tcp' end |
#to_s ⇒ String
Return the port as a string.
70 71 72 |
# File 'lib/ruby-nessus/version2/port.rb', line 70 def to_s "#{@service} (#{@number}/#{@protocol})" end |
#udp? ⇒ Boolean
Return true if the port protocol is udp.
47 48 49 |
# File 'lib/ruby-nessus/version2/port.rb', line 47 def udp? @protocol.to_s == 'udp' end |