class methods
|
dump |
dump( anObject [, anIO] , limit=--1 )
-> anIO
|
|
Serializes anObject and all descendent objects. If
anIO is specified, the serialized data will be written to
it, otherwise the data will be returned as a String . If
limit is specified, the traversal of subobjects will be
limited to that depth. If limit is negative, no checking
of depth will be performed.
class Klass
def initialize(str)
@str = str
end
def sayHello
@str
end
end
|
o = Klass.new("hello\n") |
data = Marshal.dump(o) |
obj = Marshal.load(data) |
obj.sayHello |
» |
"hello\n" |
| load |
load( from [, aProc] )
-> anObject
|
|
Returns the result of converting the serialized data in
from into a Ruby object (possibly with associated
subordinate objects). from may be either an instance of
IO or an object that responds to to_str . If
proc is specified, it will be passed each object as it
is deserialized.
| restore |
restore( from [, aProc] )
-> anObject
|
|
A synonym for Marshal::load .
|