I've been checking String::to_s source code and found an issue.

A program like this will not work:

   class String
      def to_s
         "example"
      end
   end

   puts "Hi"

The output will be "Hi" and not "example".

This is due to C code, it checks if object is a String, and then print
it directly without calling "to_s" (it calls to_s on all other classes)

I wanted to override String::to_s to apply some color to my program
output (just to check some things) and I can't.

Is this a missing feature?

(i'm using ruby 1.8.7)

-- 
Posted via http://www.ruby-forum.com/.