Class: Arpie::MarshalProtocol

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

Overview

A procotol that simply Marshals all data sent over this protocol. Served as an example, but a viable choice for ruby-only production code. Messages are arbitary objects.

Constant Summary

Constants inherited from Protocol

Protocol::CAN_SEPARATE_MESSAGES

Constants included from Arpie

MTU

Instance Attribute Summary

Attributes inherited from Protocol

#metabuffer, #stowbuffer

Instance Method Summary collapse

Methods inherited from Protocol

#again!, #assemble, #assemble!

Methods included from Arpie

#bogon!, #incomplete!

Instance Method Details

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

Yields:

  • (Marshal.load(binary))


296
297
298
# File 'lib/arpie/protocol.rb', line 296

def from binary
  yield Marshal.load(binary)
end

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

Yields:

  • (Marshal.dump(object))


292
293
294
# File 'lib/arpie/protocol.rb', line 292

def to object
  yield Marshal.dump(object)
end