Class: Ponder::Connection
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- Ponder::Connection
- Includes:
- EventMachine::Protocols::LineText2
- Defined in:
- lib/ponder/connection.rb
Instance Method Summary collapse
- #connection_completed ⇒ Object
-
#initialize(thaum) ⇒ Connection
constructor
A new instance of Connection.
- #receive_line(line) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(thaum) ⇒ Connection
Returns a new instance of Connection.
8 9 10 |
# File 'lib/ponder/connection.rb', line 8 def initialize(thaum) @thaum = thaum end |
Instance Method Details
#connection_completed ⇒ Object
12 13 14 |
# File 'lib/ponder/connection.rb', line 12 def connection_completed @thaum.register end |
#receive_line(line) ⇒ Object
34 35 36 |
# File 'lib/ponder/connection.rb', line 34 def receive_line(line) @thaum.parse line end |
#unbind ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ponder/connection.rb', line 16 def unbind @thaum.connected = false @thaum.process_callbacks :disconnect, {} @thaum.logger.info '-- Ponder disconnected' @thaum.console_logger.info '-- Ponder disconnected' if @thaum.config.reconnect @thaum.logger.info "-- Reconnecting in #{@thaum.config.reconnect_interval} seconds" @thaum.console_logger.info "-- Reconnecting in #{@thaum.config.reconnect_interval} seconds" EventMachine::add_timer(@thaum.config.reconnect_interval) do reconnect @thaum.config.server, @thaum.config.port end else @thaum.logger.close end end |