Hi,
In message "[ruby-talk:28052] How does puts decide how to print a given object?"
on 01/12/10, "Harry Ohlsen" <harryo / zip.com.au> writes:
|This got me to thinking how puts does its conversion to a string. I ask
|because (a) I'm surprised it doesn't just use to_s and because someone
|reading the article is bound to ask :-).
"puts a" does
if a is an array
puts each element of it
else
a = a.to_s
print a
print "\n" unless a[-1] == ?\n
end
Use print for simpler behavior.
matz.