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, VERSION

Instance Method Summary collapse

Methods inherited from Protocol

#assemble, #assemble!

Methods included from Arpie

#bogon!, #incomplete!

Instance Method Details

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

Yields:

  • (Marshal.load(binary))


283
284
285
# File 'lib/arpie/protocol.rb', line 283

def from binary
  yield Marshal.load(binary)
end

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

Yields:

  • (Marshal.dump(object))


279
280
281
# File 'lib/arpie/protocol.rb', line 279

def to object
  yield Marshal.dump(object)
end