I just had another reminder why I like late binding and flexible typing so much: I had written a handy little utility in Ruby for collecting some data, writing to an open file as data was collected and processed. Initially, I thought: why buffer everything in memory? Then I had the need to use the same functionality to dynamically generate a download from a web app, but I did not have to change any code: I need to collect text and send it out in a Rails controller (instead of using a view) back to a client web browser – I needed in-memory data, not a local file.
Well, since both String and File classes support
Anyway, not a big deal, but it did save me refactoring some old code for a new use, saving a few minutes.
