Class: Genesis::Echo::Server
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- Genesis::Echo::Server
- Defined in:
- lib/genesis/protocol/echo/server.rb
Overview
Implement a test server to demonstrate functionality and facilitate testing
Instance Attribute Summary
Attributes included from Server
Instance Method Summary collapse
Methods included from Protocol
Methods included from Server
Instance Method Details
#receive_data(data) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/genesis/protocol/echo/server.rb', line 9 def receive_data(data) @channel << data @handle_routes.each do |verb, matchdata| case verb when 'say' matchdata.each do |pattern, blockdata| send_data blockdata[:block].call(data) if data =~ pattern end end end close_connection_after_writing end |