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
- #pack(o) ⇒ Object private
- #read(io) ⇒ Object private
- #write(io, o) ⇒ Object private
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.
179 180 181 182 |
# File 'lib/moneta/mixins.rb', line 179 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.
184 185 186 187 |
# File 'lib/moneta/mixins.rb', line 184 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.
189 190 191 |
# File 'lib/moneta/mixins.rb', line 189 def write(io, o) io.write(pack(o)) end |