A
Andreas S
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"
STDOUT.puts "hello"
$stdout.puts "hello"
=> hello
I say hello
I say hello
Thank you in advance
-andre
_________________________________________________________________
Talk now to your Hotmail contacts with Windows Live Messenger.
http://clk.atdmt.com/MSN/go/msnnkwm.../?href=http://get.live.com/messenger/overview
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"
STDOUT.puts "hello"
$stdout.puts "hello"
=> hello
I say hello
I say hello
Thank you in advance
-andre
_________________________________________________________________
Talk now to your Hotmail contacts with Windows Live Messenger.
http://clk.atdmt.com/MSN/go/msnnkwm.../?href=http://get.live.com/messenger/overview