Hello all,
I'm trying to Marshal some Ruby objects to file and I have a question
about parent classes. Say I have the following:
class Device
@@id = 0
@@id_map = Hash.new
@@device_map = Hash.new
def initialize(*args)
id = @@id += 1
@@id_map[self] = id
@@device_map[id] = self
end
def self.id(device)
return @@id_map[device]
end
def self.device(id)
return @@device_map[id]
end
end
class Foo < Device
def initialize
super
end
end
Now, if I create a Foo class, dump it to file and then load it again
using Marshal, should I be able to use the id and device methods in the
parent class or will the class variables not be dumped and loaded?
···
--
Thanks!
Bryan
--
Posted via http://www.ruby-forum.com/.