Class: HttpEventLogger::Event::Connection
- Inherits:
-
Object
- Object
- HttpEventLogger::Event::Connection
- Defined in:
- lib/http_event_logger/event/connection.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host, port) ⇒ Connection
constructor
A new instance of Connection.
- #uri ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/http_event_logger/event/connection.rb', line 6 def host @host end |
#port ⇒ Object (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
#uri ⇒ Object
14 15 16 |
# File 'lib/http_event_logger/event/connection.rb', line 14 def uri @port.present? ? "#{@host}:#{@port}" : @host end |