module Ruby::Marshal

Defined in:

ruby-marshal.cr
ruby-marshal/exception.cr
ruby-marshal/stream_object_factory.cr
ruby-marshal/stream_objects/array.cr
ruby-marshal/stream_objects/bignum.cr
ruby-marshal/stream_objects/byte_sequence.cr
ruby-marshal/stream_objects/class.cr
ruby-marshal/stream_objects/extended_object.cr
ruby-marshal/stream_objects/false.cr
ruby-marshal/stream_objects/float.cr
ruby-marshal/stream_objects/four_byte_negative_int.cr
ruby-marshal/stream_objects/four_byte_positive_int.cr
ruby-marshal/stream_objects/hash.cr
ruby-marshal/stream_objects/hash_with_default.cr
ruby-marshal/stream_objects/heap.cr
ruby-marshal/stream_objects/instance_object.cr
ruby-marshal/stream_objects/integer.cr
ruby-marshal/stream_objects/module.cr
ruby-marshal/stream_objects/null.cr
ruby-marshal/stream_objects/object.cr
ruby-marshal/stream_objects/object_pointer.cr
ruby-marshal/stream_objects/one_byte_int.cr
ruby-marshal/stream_objects/one_byte_negative_int.cr
ruby-marshal/stream_objects/one_byte_positive_int.cr
ruby-marshal/stream_objects/regex.cr
ruby-marshal/stream_objects/stream_object.cr
ruby-marshal/stream_objects/string.cr
ruby-marshal/stream_objects/struct.cr
ruby-marshal/stream_objects/symbol.cr
ruby-marshal/stream_objects/symbol_pointer.cr
ruby-marshal/stream_objects/three_byte_negative_int.cr
ruby-marshal/stream_objects/three_byte_positive_int.cr
ruby-marshal/stream_objects/true.cr
ruby-marshal/stream_objects/two_byte_negative_int.cr
ruby-marshal/stream_objects/two_byte_positive_int.cr
ruby-marshal/stream_objects/user_class.cr
ruby-marshal/stream_objects/zero_byte_int.cr
ruby-marshal/version.cr

Constant Summary

MAJOR_VERSION = 4
MINOR_VERSION = 8
VERSION = "0.1.0"

Class Method Summary

Class Method Detail

def self._load(source : Bytes) #

The first two bytes of the stream contain the major and minor version, each as a single byte encoding a digit. The version implemented in Ruby is 4.8 (stored as “x04x08”) and is supported by ruby 1.8.0 and newer.

Different major versions of the Marshal format are not compatible and cannot be understood by other major versions. Lesser minor versions of the format can be understood by newer minor versions. Format 4.7 can be loaded by a 4.8 implementation but format 4.8 cannot be loaded by a 4.7 implementation.

Following the version bytes is a stream describing the serialized object. The stream contains nested objects (the same as a Ruby object) but objects in the stream do not necessarily have a direct mapping to the Ruby object model.

Each object in the stream is described by a byte indicating its type followed by one or more bytes describing the object. When “object” is mentioned below it means any of the types below that defines a Ruby object. https://ruby-doc.org/core-2.2.2/doc/marshal_rdoc.html


[View source]
def self.load(klass : ::Class, source : ::String) #

[View source]
def self.load(klass : ::Class, source : IO) #

[View source]
def self.load(source : ::String) #

[View source]
def self.load(source : IO) #

[View source]
def self.process_stream(stream : Bytes) : StreamObject #

[View source]
def self.validate_version!(source : Bytes) #

First 2 bytes contain the version


[View source]