Class: Nessana::Detection

Inherits:
Object
  • Object
show all
Defined in:
lib/nessana/detection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/nessana/detection.rb', line 3

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



3
4
5
# File 'lib/nessana/detection.rb', line 3

def port
  @port
end

#protocolObject (readonly)

Returns the value of attribute protocol.



3
4
5
# File 'lib/nessana/detection.rb', line 3

def protocol
  @protocol
end

#statusObject

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

#hashObject



17
18
19
# File 'lib/nessana/detection.rb', line 17

def hash
  "#{@host}:#{@port}/#{@protocol}".hash
end

#to_sObject



13
14
15
# File 'lib/nessana/detection.rb', line 13

def to_s
  "#{@status ? status_prefix : ''}#{@host}:#{@port}/#{@protocol}"
end