Class: LibSL::CircuitHandler
- Inherits:
-
EventMachine::Connection
- Object
- EventMachine::Connection
- LibSL::CircuitHandler
- Defined in:
- lib/network.rb
Instance Method Summary collapse
-
#initialize(sim) ⇒ CircuitHandler
constructor
Handles the connection (or circuit in SL).
-
#receive_data(data) ⇒ Object
Called when data is received from the circuit.
- #unbind ⇒ Object
Constructor Details
#initialize(sim) ⇒ CircuitHandler
Handles the connection (or circuit in SL)
11 12 13 |
# File 'lib/network.rb', line 11 def initialize(sim) @sim = sim end |
Instance Method Details
#receive_data(data) ⇒ Object
Called when data is received from the circuit
17 18 19 20 |
# File 'lib/network.rb', line 17 def receive_data(data) packet = Packet::decode(data) @sim.packet_received packet end |
#unbind ⇒ Object
22 23 24 |
# File 'lib/network.rb', line 22 def unbind EventManager::fire_event :disconnected, @sim end |