I’ve got a Hash with a default proc that I’d like to Marshal to a file, but the default proc prevents me from doing that.
Rather than writing my own _dump and _load methods, is it possible instead to remove the default proc instead? At the point where I’m Marshalling I’m never going to need the default proc again.
Just reset the default:
More explicitly:
In Ruby 2.0, you can also write
h.default_proc = nilif you prefer. Available for all Rubies withrequire 'backports/2.0.0/hash/default_proc'.