Class: ObjectStream::MarshalStream

Inherits:
Object
  • Object
show all
Includes:
ObjectStream
Defined in:
lib/object-stream.rb

Constant Summary

Constants included from ObjectStream

DEFAULT_MAX_OUTBOX, JSON_TYPE, MARSHAL_TYPE, MSGPACK_TYPE, TYPES, VERSION, YAML_TYPE

Instance Attribute Summary

Attributes included from ObjectStream

#io, #max_outbox

Instance Method Summary collapse

Methods included from ObjectStream

#close, #closed?, #each, #eof?, #flush_buffer, #flush_outbox, #initialize, new, #read, #read_one, register_type, stream_class_for, #to_io, #to_s, #write, #write_to_buffer, #write_to_outbox

Instance Method Details

#read_from_stream {|Marshal.load(io)| ... } ⇒ Object

Yields:

  • (Marshal.load(io))


196
197
198
# File 'lib/object-stream.rb', line 196

def read_from_stream
  yield Marshal.load(io)
end

#write_to_stream(object) ⇒ Object



200
201
202
203
# File 'lib/object-stream.rb', line 200

def write_to_stream object
  Marshal.dump(object, io)
  self
end