Module: Evilution::Parallel::WorkQueue::Channel Private

Defined in:
lib/evilution/parallel/work_queue/channel.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: Frame

Class Method Summary collapse

Class Method Details

.read(io) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
# File 'lib/evilution/parallel/work_queue/channel.rb', line 13

def read(io)
  header = io.read(4)
  return nil if header.nil? || header.bytesize < 4

  length = header.unpack1("N")
  payload = io.read(length)
  Frame.decode(header, payload)
end

.write(io, object) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
# File 'lib/evilution/parallel/work_queue/channel.rb', line 8

def write(io, object)
  io.write(Frame.encode(object))
  io.flush
end