Class: HttpEventLogger::Event::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/http_event_logger/event/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Connection

Returns a new instance of Connection.



8
9
10
11
12
# File 'lib/http_event_logger/event/connection.rb', line 8

def initialize(host, port)
  @host = host
  @port = port ? port.to_s : nil
  HttpEventLogger::Event::Observer.observe(:connected, self)
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/http_event_logger/event/connection.rb', line 6

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



6
7
8
# File 'lib/http_event_logger/event/connection.rb', line 6

def port
  @port
end

Instance Method Details

#uriObject



14
15
16
# File 'lib/http_event_logger/event/connection.rb', line 14

def uri
  @port.present? ? "#{@host}:#{@port}" : @host
end