3 ms·
Ruby has "ensure" if you want something to be guaranteed to run on exit - it can be used at the end of methods, or by explicitly wrapping code in begin .. end.
by vidarh 15y ago
Ruby has "ensure" if you want something to be guaranteed to run on exit - it can be used at the end of methods, or by explicitly wrapping code in begin .. end.
- radiowave 15y ago(Assuming it works the same way as Smalltalk's ensure...) a really nice aspect of this is that the resource is held open while you're in the debugger, but cleaned up when you finish debugging.