AMarshal - marshal a Ruby object as Ruby code

AMarshal is a library for marshaling a Ruby object as a Ruby code. It can marshal objects which have cyclic reference.

Usage

AMarshal is similar to Marshal.

% ruby -ramarshal -e 'AMarshal.dump([1,2,3], STDOUT)'
v = []
v[0] = Array.allocate()
v[0] << 1
v[0] << 2
v[0] << 3
v[0]

Highly experimental pretty printing version also exists:

% ruby -ramarshal-pretty -e '
  o = [1,2]
  o << [[3], [[4]], [[[o]]]]
  o = [5, o, [[[o]]], o] 
  AMarshal.dump_pretty(o, STDOUT)'
v = []
v[0] = Array.allocate
v[0] << 1
v[0] << 2
v[0] << [[3], [[4]], [[[v[0]]]]]
[5, v[0], [[[v[0]]]], v[0]]

Requirements

Download AMarshal

with HTTP to get (relatively) stable tarball:

amarshal-0.4.tar.gz

with HTTP to get latest tarball:

amarshal-latest.tar.gz

with CVS:
% cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/ruby login
(Logging in to anonymous@cvs.m17n.org)
CVS password: (just hit return)
% cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/ruby co amarshal
The cvs password can be any string.
with ViewCVS:

click here to browse source code.


akr@m17n.org