Module: Moneta::Net Private

Included in:
Adapters::Client, Server
Defined in:
lib/moneta/mixins.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

Classes: Error

Constant Summary collapse

DEFAULT_PORT =

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.

9000

Instance Method Summary collapse

Instance Method Details

#pack(o) ⇒ 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.



293
294
295
296
# File 'lib/moneta/mixins.rb', line 293

def pack(o)
  s = Marshal.dump(o)
  [s.bytesize].pack('N') << s
end

#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.



298
299
300
301
# File 'lib/moneta/mixins.rb', line 298

def read(io)
  size = io.read(4).unpack('N').first
  Marshal.load(io.read(size))
end

#write(io, o) ⇒ 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.



303
304
305
# File 'lib/moneta/mixins.rb', line 303

def write(io, o)
  io.write(pack(o))
end