From: Abder-Rahman Ali Date: 2010-08-23T23:08:15+09:00 Subject: Class initialization This is an example similar to the one here: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/56755 class Foo def initialize @var = "var" end def to_s "This is a customized string" end end var = Foo.new puts var There are some scenarios I'm doing here: 1- When I remove "def to_s" method, and for "puts var", I change it as follows: puts var.to_s Result: # 2- in "def to_s": def to_s @var end Result: var 3- Running the code as it is shown at the top. Result: "This is a customized string" 4- Without "def to_s". Result: # The most parts that are confusing me here are scenarios (1) and (4). Why are the following results? And, what do those results mean by the way? Thanks. -- Posted via http://www.ruby-forum.com/.