naught icon indicating copy to clipboard operation
naught copied to clipboard

black_hole and Marshal.dump don't work together?

Open nanaya opened this issue 7 years ago • 0 comments

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))

nanaya avatar Dec 12 '17 18:12 nanaya