From: Martin Elzen Date: 2005-07-26T21:48:10+09:00 Subject: defining to_s works oddly? Hi all. Am I the only one that finds it odd that if I define a to_s function for a class, that if I do: puts obj I won't get errors, but if I try something like: s = String.new s += obj I get a 'can not convert a ' into String type error'... It's no prob to write obj.to_s, it's just I expected the first version to call to_s automatically... Martin PS for clarity, my complete error producing example is as follows: class Animal def initialize(name) fail "name is nil" if name.nil? @name = name end def to_s "#{@name}" end end c = Animal.new('Snoes') puts c puts "substituted in a string literal: #{c}" s = String.new s += c #puts s