naught
naught copied to clipboard
black_hole and Marshal.dump don't work together?
Is the user supposed to define their own #marshal_dump
so it can work with Marshal
?
NullObject = Naught.build { |c| c.black_hole }
# fails because marshal_dump returns itself and triggers recursive loop failsafe
Marshal.load(Marshal.dump(NullObject.new))
NullObjectWithDump = Naught.build do |c|
c.black_hole
def marshal_dump
end
end
# works
Marshal.load(Marshal.dump(NullObjectWithDump.new))