Class: Mutant::Pipe::Connection::Frame Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/pipe.rb

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

Constant Summary collapse

HEADER_FORMAT =

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

'N'
MAX_BYTES =

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

(2**32).pred
HEADER_SIZE =

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

4

Instance Method Summary collapse

Instance Method Details

#receive_valueObject

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.



50
51
52
53
# File 'lib/mutant/pipe.rb', line 50

def receive_value
  header = read(HEADER_SIZE)
  read(Util.one(header.unpack(HEADER_FORMAT)))
end

#send_value(body) ⇒ 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.



55
56
57
58
59
60
61
62
63
# File 'lib/mutant/pipe.rb', line 55

def send_value(body)
  bytesize = body.bytesize

  fail Error, 'message to big' if bytesize > MAX_BYTES

  io.binmode
  io.write([bytesize].pack(HEADER_FORMAT))
  io.write(body)
end