Class: Arpie::YAMLProtocol

Inherits:
Protocol show all
Defined in:
lib/arpie/protocol.rb

Overview

A protocol which encodes objects into YAML representation. Messages are arbitary yaml-encodable objects.

Constant Summary

Constants inherited from Protocol

Protocol::CAN_SEPARATE_MESSAGES

Constants included from Arpie

MTU, VERSION

Instance Method Summary collapse

Methods inherited from Protocol

#assemble, #assemble!

Methods included from Arpie

#bogon!, #incomplete!

Instance Method Details

#from(binary) {|YAML.load(binary)| ... } ⇒ Object

Yields:

  • (YAML.load(binary))


332
333
334
335
# File 'lib/arpie/protocol.rb', line 332

def from binary
  yield YAML.load(binary)
  binary.size
end

#to(object) {|YAML.dump(object)| ... } ⇒ Object

Yields:

  • (YAML.dump(object))


328
329
330
# File 'lib/arpie/protocol.rb', line 328

def to object
  yield YAML.dump(object)
end