module

Ruby::Marshal

Constants

MAJOR_VERSION = 4
MINOR_VERSION = 8
VERSION = "0.1.0"

Class methods

_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

Source
load(klass : ::Class, source : ::String)
Source
load(klass : ::Class, source : IO)
Source
load(source : ::String)
Source
load(source : IO)
Source
process_stream(stream : Bytes) : StreamObject
Source
validate_version!(source : Bytes)

First 2 bytes contain the version

Source

Nested types