From: Morton Goldberg Date: 2007-12-02T21:35:17+09:00 Subject: Re: alias problem On Dec 2, 2007, at 12:20 AM, Pokkai Dokkai wrote: > Gavin Kistner wrote: >> On Dec 1, 4:41 am, Pokkai Dokkai wrote: >> Slim2:~ phrogz$ ri private > > hey please understand my question correctly > that is , > change public definition(public method) to private definition(private > method) by > using some ideas.... > > i want like this (ofcourse below is wrong) > ------------------------------------------------- > class Cls1 > def view > puts "from view" > end > def self.pp > alias :private view :public view > end > end > c1=Cls1.new > c1.view ----->from view > Cls1.pp > c1.view ----->undefined method `view' for # > (NoMethodError) I don't believe you can do what I think you want with 'alias'. Maybe the following will work for you. class Cls1 def view puts "from view" end end c1 = Cls1.new c1.view class Cls1 private :view end c1.view from view NoMethodError: private method ‘view’ called for # Regards, Morton