Class: Nessana::Detection
- Inherits:
-
Object
- Object
- Nessana::Detection
- Defined in:
- lib/nessana/detection.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(host, protocol, port, status = nil) ⇒ Detection
constructor
A new instance of Detection.
- #to_s ⇒ Object
Constructor Details
#initialize(host, protocol, port, status = nil) ⇒ Detection
6 7 8 9 10 11 |
# File 'lib/nessana/detection.rb', line 6 def initialize(host, protocol, port, status = nil) @host = host @protocol = protocol @port = port @status = status end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/nessana/detection.rb', line 3 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/nessana/detection.rb', line 3 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
3 4 5 |
# File 'lib/nessana/detection.rb', line 3 def protocol @protocol end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/nessana/detection.rb', line 4 def status @status end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
21 22 23 24 25 26 |
# File 'lib/nessana/detection.rb', line 21 def ==(other) @host == other.host && @protocol == other.protocol && @port == other.port && @status == other.status || false end |
#hash ⇒ Object
17 18 19 |
# File 'lib/nessana/detection.rb', line 17 def hash "#{@host}:#{@port}/#{@protocol}".hash end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/nessana/detection.rb', line 13 def to_s "#{@status ? status_prefix : ''}#{@host}:#{@port}/#{@protocol}" end |