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.


208
209
210
211
# File 'lib/moneta/mixins.rb', line 208

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.


213
214
215
216
# File 'lib/moneta/mixins.rb', line 213

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.


218
219
220
# File 'lib/moneta/mixins.rb', line 218

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