From: "Daniel Völkerts" Date: 2004-07-29T19:31:48+09:00 Subject: to_s isn't automatically called Hello there, perhaps it is a newbies fault, but I can't figure out where to find my logical failure. I'd like to build up a Tree for a Document. The result should contain a string represantion of this document (e.g. HTML file). I started writing ... class Tag def to_s yield end end Thats easy so I went on ... class HtmlTag < Tag def to_s ''+yield'' end end That looks the way I want it to look like, but if I call the following Html = HtmlTag.new # Okay, not valid HTML. Just for testing. puts Html {'Hello'} The interpreter returned tags.rb:27: undefined method `Html' for main:Object (NoMethodError) I understand this messages as the Mainobject doesn't have such method, but why doesn't he send a message to Html called 'to_s'? If I write Test = String.new('Test') and execute a puts Test He works fine an returned 'Test'. Please point me to a solution. TIA. -- Daniel V�lkerts :: "Ich habe einen Drachen, und ich WERDE ihn benutzen!" - Esel in Shrek