Class: NFAgent::Event
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- NFAgent::Event
- Defined in:
- lib/nfagent/event.rb
Instance Method Summary collapse
-
#initialize(chunk_handler) ⇒ Event
constructor
A new instance of Event.
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
- #unbind ⇒ Object
Constructor Details
#initialize(chunk_handler) ⇒ Event
Returns a new instance of Event.
3 4 5 |
# File 'lib/nfagent/event.rb', line 3 def initialize(chunk_handler) @handler = chunk_handler end |
Instance Method Details
#post_init ⇒ Object
7 8 9 |
# File 'lib/nfagent/event.rb', line 7 def post_init Log.info "Client Connected" end |
#receive_data(data) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/nfagent/event.rb', line 11 def receive_data(data) if data && data.length > 2 @handler.submit(data) end send_data('OK') end |
#unbind ⇒ Object
18 19 20 |
# File 'lib/nfagent/event.rb', line 18 def unbind Log.info "Disconnected" end |