Module: Zerg::Support::Protocols::ObjectProtocol
- Includes:
- FrameProtocol
- Defined in:
- lib/zerg_support/protocols/object_protocol.rb
Overview
Event Machine protocol for sending serializable objects.
Instance Method Summary collapse
-
#received_frame(frame_data) ⇒ Object
:nodoc: Processes an incoming frame and de-serializes the object in it.
-
#received_object(object) ⇒ Object
Override to process incoming objects.
-
#send_object(object) ⇒ Object
Send a serialized object.
Methods included from FrameProtocol
decode_natural, encode_frame, encode_natural, #received_bytes, #send_frame
Instance Method Details
#received_frame(frame_data) ⇒ Object
:nodoc: Processes an incoming frame and de-serializes the object in it.
16 17 18 |
# File 'lib/zerg_support/protocols/object_protocol.rb', line 16 def received_frame(frame_data) received_object YAML.load(frame_data) end |
#received_object(object) ⇒ Object
Override to process incoming objects.
21 |
# File 'lib/zerg_support/protocols/object_protocol.rb', line 21 def received_object(object); end |
#send_object(object) ⇒ Object
Send a serialized object.
11 12 13 |
# File 'lib/zerg_support/protocols/object_protocol.rb', line 11 def send_object(object) send_frame YAML.dump(object) end |