Class: Pantry::Communication::SerializeMessage
- Inherits:
-
Object
- Object
- Pantry::Communication::SerializeMessage
- Defined in:
- lib/pantry/communication/serialize_message.rb
Overview
Handles all serialization of Pantry::Messages to and from the ZeroMQ communication stack
Defined Under Namespace
Classes: FromZeromq, ToZeromq
Constant Summary collapse
- IS_JSON =
To prevent accidents like trying to send the raw contents of a JSON file and end up with a Ruby hash on the other side, we designate messages as being JSON using a simple one character prefix. This way we don’t have to guess if it’s JSON or not and will leave non encoded strings alone. Don’t want to dive into anything more complicated unless it’s really necessary (like msgpack).
'⁂'
Class Method Summary collapse
-
.from_zeromq(parts) ⇒ Object
Given an array of message parts from ZeroMQ, built up a Pantry::Message containing the included information.
-
.to_zeromq(message) ⇒ Object
Convert a message into an array of message parts that will be sent through ZeroMQ.
Class Method Details
.from_zeromq(parts) ⇒ Object
Given an array of message parts from ZeroMQ, built up a Pantry::Message containing the included information.
24 25 26 |
# File 'lib/pantry/communication/serialize_message.rb', line 24 def self.from_zeromq(parts) FromZeromq.new(parts).perform end |