3 ms·
Ah, you're right. They do have observably different behavior. But I can't even close an open file handle after a break. That's still pretty miserable.
by chowells 1y ago
Ah, you're right. They do have observably different behavior. But I can't even close an open file handle after a break. That's still pretty miserable.
- HellzStormer 1y agoYes you can, you use a finally clause around your call to yield, as you would already do to handle possible exceptions happening in the block. So no extra consideration is needed.
- dragonwriter 1y ago> But I can't even close an open file handle after a break. Yes, you can. That's what ensure (the Ruby equivalent of "finally") is for. Or, better using File.open with a block where you do the work, which uses ensure under the hood.