Ah, yes, I decided to snoop around in the c files and this fits what I thought I saw in there. Thanks so much to all. Regards, -andre >From: Eric Hodel <drbrain / segment7.net> >Reply-To: ruby-talk / ruby-lang.org >To: ruby-talk / ruby-lang.org (ruby-talk ML) >Subject: Re: beginner Q: Kernel#puts, STDOUT, $stdout relation >Date: Sat, 9 Dec 2006 09:39:56 +0900 > >On Dec 8, 2006, at 14:16 , Andreas S wrote: >>Can anybody help me understanding the relation between Kernel#puts, >>STDOUT and $stdout? >> >>I thought 'puts' is equivalent to '$stdout.puts'. Why 'puts' doesn't give >>same result as 'STDOUT.puts'? >> >>class << STDOUT >> def puts(*args) >> args[0] = "I say " + args[0] unless args.empty? >> super(args) >> end >>end >> >>puts "hello" > >This calls $stdout.write "hello\n" > >>STDOUT.puts "hello" >>$stdout.puts "hello" >>=> hello >> I say hello >> I say hello > >PS: > >Please mess with $stdout, not STDOUT, if at all possible. > >http://blog.segment7.net/articles/2006/08/17/stdout-vs-stdout > >-- >Eric Hodel - drbrain / segment7.net - http://blog.segment7.net > >I LIT YOUR GEM ON FIRE! > > _________________________________________________________________ Talk now to your Hotmail contacts with Windows Live Messenger. http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://get.live.com/messenger/overview