Hi, Cheryl

>    if(x.respond_to?(:each))
x is not defined here.
This is not x but self, isn't it?

The following code works well.

class String
 remove_method(:each)
end

class Object
 def reach
   if(self.respond_to?(:each))  # <<<
     self.each{|x| x.reach(yield)}
   else
     yield(self)
   end
 end
end

"hoge".reach { |myself|
 print myself
}

-- 
Haruka YAGNI
hyagni / gmail.com