Morton Goldberg wrote:
> On Dec 2, 2007, at 12:20 AM, Pokkai Dokkai wrote:

You could also do something similar to to Morton's solution, but on the 
metaclass. This would me that you would only make that method private 
for the specific instance of the object you're currently working with. 
You could also do it from an instance method (like in your example). Is 
this what you were looking for?

class Stuff
  def metaclass
    class << self; self; end
  end

  def my_method
    puts "hi from method!"
  end

  def pp
    metaclass.instance_eval do
      private :my_method
    end
  end
end

s = Stuff.new
s.my_method
s.pp
s.my_method
-- 
Posted via http://www.ruby-forum.com/.