From: Rob Olson Date: 2009-03-31T08:34:52+09:00 Subject: Re: Which methods does "puts" invoke? On Mar 30, 2:16 pm, Iņaki Baz Castillo wrote: > Hi, if I redefine "to_s" or "inspect" methods in String class I still get the > original output when doing: > >   puts string > > Which String@method is invoked when executing "puts"? > > Thanks. > > -- > Iņaki Baz Castillo From the rdoc of IO#puts (http://www.ruby-doc.org/core-1.8.7/classes/ IO.html#M000474) it states that puts "writes the given objects to ios as with IO#print". So puts calls print. Further, the rdoc for IO#print ssays that objects passed to it "that aren‘t strings will be converted by calling their to_s method." -- Rob Olson http://thinkingdigitally.com