Module: Cognizant::Client::Transport
- Defined in:
- lib/cognizant/client.rb
Overview
Keep this in this file so client can be loaded entirely standalone by user code.
Class Method Summary collapse
- .deserialize_message(line) ⇒ Object
- .receive_message(socket) ⇒ Object
- .send_message(socket, message) ⇒ Object
- .serialize_message(message) ⇒ Object
Class Method Details
.deserialize_message(line) ⇒ Object
26 27 28 29 |
# File 'lib/cognizant/client.rb', line 26 def self.(line) serialized = URI.unescape(line) YAML.load(serialized) end |
.receive_message(socket) ⇒ Object
15 16 17 18 |
# File 'lib/cognizant/client.rb', line 15 def self.(socket) line = socket.readline (line) end |
.send_message(socket, message) ⇒ Object
10 11 12 13 |
# File 'lib/cognizant/client.rb', line 10 def self.(socket, ) line = () socket.write(line) end |
.serialize_message(message) ⇒ Object
20 21 22 23 24 |
# File 'lib/cognizant/client.rb', line 20 def self.() serialized = YAML.dump() escaped = URI.escape(serialized, "%\n") escaped + "\n" end |