Class: Arpie::YAMLProtocol
Overview
A protocol which encodes objects into YAML representation. Messages are arbitary yaml-encodable objects.
Constant Summary collapse
- CAN_SEPARATE_MESSAGES =
true
Constants included from Arpie
Instance Attribute Summary
Attributes inherited from Protocol
Instance Method Summary collapse
- #from(binary) {|YAML.load(binary[0, index])| ... } ⇒ Object
- #to(object) {|YAML.dump(object) + "...\n"| ... } ⇒ Object
Methods inherited from Protocol
#again!, #assemble, #assemble!
Methods included from Arpie
Instance Method Details
#from(binary) {|YAML.load(binary[0, index])| ... } ⇒ Object
347 348 349 350 351 |
# File 'lib/arpie/protocol.rb', line 347 def from binary index = binary =~ /^\.\.\.$/x or incomplete! yield YAML.load(binary[0, index]) 4 + index end |
#to(object) {|YAML.dump(object) + "...\n"| ... } ⇒ Object
343 344 345 |
# File 'lib/arpie/protocol.rb', line 343 def to object yield YAML.dump(object) + "...\n" end |