M
Michael Davis
Hello all,
I have an issue with marshal_dump in Ruby 1.8 that I can't seem to work around. I have a Hash the contains a proc object and I need to Marshal.dump the Hash. I have included a marshal_dump method to eliminate the proc object from the Hash but I still get an error during the Marshal.dump. The error message is:
"class Proc needs to have instance method `_dump_data'"
Any suggestions is greatly appreciated.
Here is a very specific example that reproduces the error:
class MyClass < Hash
def initialize(attr)
self.update(attr)
end
def marshal_dump() #:nodoc:
self.delete
test)
puts self.inspect
super
end
end
a = MyClass.new
test=>proc{puts 'test'}, :test2=>2)
puts Marshal.dump(a).inspect
exit
Thanks in advance, Michael Davis
I have an issue with marshal_dump in Ruby 1.8 that I can't seem to work around. I have a Hash the contains a proc object and I need to Marshal.dump the Hash. I have included a marshal_dump method to eliminate the proc object from the Hash but I still get an error during the Marshal.dump. The error message is:
"class Proc needs to have instance method `_dump_data'"
Any suggestions is greatly appreciated.
Here is a very specific example that reproduces the error:
class MyClass < Hash
def initialize(attr)
self.update(attr)
end
def marshal_dump() #:nodoc:
self.delete
puts self.inspect
super
end
end
a = MyClass.new
puts Marshal.dump(a).inspect
exit
Thanks in advance, Michael Davis