From: Christopher Dicely Date: 2009-09-22T10:44:43+09:00 Subject: Re: redirect STDOUT to function? On Mon, Sep 21, 2009 at 6:07 PM, Jonathan Castello wrote: > I know that $stdout and others can be reassigned to other IO objects, but I haven't yet found a way to reliably > redirect through a function instead. Of course, this is probably because I'm relatively new to Ruby. > Does anyone know how I could do something like this?~Jonathan Castello I haven't tried this, but you should be able to create an IO-like class/object where the methods you care about are (or call) the custom functions you want to use. It would be nice if there was an module you could mix into an object that implemented a few of the more basic function which would build on those to provide the rest of the IO interface, the way Enumerable builds on an "each" method in the class its mixed into.