Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black_hole and Marshal.dump don't work together? #72

Open
nanaya opened this issue Dec 12, 2017 · 0 comments
Open

black_hole and Marshal.dump don't work together? #72

nanaya opened this issue Dec 12, 2017 · 0 comments

Comments

@nanaya
Copy link

nanaya commented Dec 12, 2017

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant