mwg API
    Preparing search index...

    Function encodeMarshal

    • Encodes one Marshal document from the same shapes decodeMarshal produces: null, boolean, number (written as a Fixnum when it is a safe integer, a Float otherwise), string (a Marshal String, unless wrapped in RubySymbol), Array, Map (a Hash, key order preserved), and RubyObject.

      Every value is written fresh rather than reusing Ruby's own backreference scheme for a repeated string, symbol or object - valid Marshal either way, since backreferences are an optional size optimisation, not something a reader is required to produce. A save written this way is larger than Ruby's own Marshal.dump would make it, never incorrect. RubyUserDefined (a _dump/_load value) cannot be re-encoded at all, for the same reason decodeMarshal cannot interpret its bytes: that per-class binary layout is a second format this module was never taught.

      Parameters

      • value: unknown

      Returns Uint8Array