Bugs item #9376, was opened at 2007-03-20 00:58
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9376&group_id=426

Category: Core
Group: 1.8.6
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Sylvain Joyeux (lapinot)
Assigned to: Nobody (None)
Summary: Marshal.dump shouldn't complain about singletons if the _dump method is defined

Initial Comment:
Some of the objects I dump have singleton classes. It's not an accident, and I'm aware of that. The thing is that I defined _dump, thinking it would tell the interpreter that I know what I'm doing. It's not the case. Is that really the intended behaviour ?

Here is the testcase:

[~/dev/urus]% cat tmp.rb
class Test
    def _dump(lvl)
        ""
    end
end

t = Test.new
class << t
    @bla = 10
end
Marshal.dump(t)


[~/dev/urus]% ruby tmp.rb
tmp.rb:11:in `dump': singleton can't be dumped (TypeError)
        from tmp.rb:11

[~/dev/urus]% ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-linux]


----------------------------------------------------------------------

Comment By: Yukihiro Matsumoto (matz)
Date: 2007-05-10 12:00

Message:
This bug is fixed in the repository.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9376&group_id=426