Hi --

On Thu, 16 Aug 2007, Giles Bowkett wrote:

> I'm attempting to redefine existing methods with class_eval() and
> nothing's happening. Assuming my namespaces are right, is there
> anything else to watch out for? The methods I'm targeting are private
> instance methods. Does being private somehow shield them from
> class_eval? I would have thought the answer was definitely no but the
> redefinition is definitely floundering.

Can you show an example? I've tried this:

class C
   def x
     1
   end
   private :x
end

C.class_eval { def x; 2; end }

p C.new.x    # 2


and it works OK.


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)