From: Jonathan Castello Date: 2009-09-22T11:01:06+09:00 Subject: Re: redirect STDOUT to function? --_9a92b937-3016-41ab-b320-52fdd0ef6555_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On the module suggestion=2C that would definitely be pretty great! Also=2C = I've already considered the IO-like class=2C and I'm just not sure where to= start. I don't know what method(s) puts/p/gets/et cetera depend on=2C or w= hat the dependencies depend on=3B it's a fairly difficult problem for a new= comer to Ruby like me. > Date: Tue=2C 22 Sep 2009 10:44:43 +0900 > From: cmdicely@gmail.com > Subject: Re: redirect STDOUT to function? > To: ruby-talk@ruby-lang.org >=20 > On Mon=2C Sep 21=2C 2009 at 6:07 PM=2C Jonathan Castello wrote: >=20 > > I know that $stdout and others can be reassigned to other IO objects=2C= but I haven't yet found a way to reliably > > redirect through a function instead. Of course=2C this is probably beca= use I'm relatively new to Ruby. > > Does anyone know how I could do something like this?~Jonathan Castello >=20 > I haven't tried this=2C 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=2C the way Enumerable builds on an "each" method in the class > its mixed into. >=20 _________________________________________________________________ Ready for Fall shows? Use Bing to find helpful ratings and reviews on digit= al tv's. http://www.bing.com/shopping/search?q=3Ddigital+tv's&form=3DMSHNCB&publ=3DW= LHMTAG&crea=3DTEXT_MSHNCB_Vertical_Shopping_DigitalTVs_1x1= --_9a92b937-3016-41ab-b320-52fdd0ef6555_--