Since the objects are detached from the runtime and are capable of
hooking themselves up when they come in from our persistent store, I
thought I would take a stab at serialization (Marshal.dump and
Marshal.load). I marked RubyObject Serializable and then tried this:
class Person
def initialize(name)
@name = name
end
def name
@name
end
end
# in one VM
p = Person.new("Alan")
File.open("person", "w+") do |f|
Marshal.dump(p, f)
end
# in another VM
p = nil
File.open("person") do |f|
p = Marshal.load(f)
end
puts p.name
It works. Of course, this uses Java serialization, so you can't
serialize to another Ruby VM, but I thought maybe this would be a
good start.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email