From: Ruby Admirer Date: 2007-03-23T02:34:51+09:00 Subject: Re: About class methods visibility (public/private) --0-316030708-1174584879=:23815 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit >Phrogz wrote: >...you see that most methods with "method" in their name return >something about methods, but the last two cause a change to the method >'scope'. I can see the confusion in particular between the first two >and the last two: > >Klass.method( :foo ) #=> find a method >Klass.public_class_method( :foo ) #=> change scope >Klass.instance_method( :foo ) #=> find a method Exactly ! >The other question of the OP was "I know about three scopes in Ruby: >'public', 'protected', and 'private'. However, I only see >#public_class_method and #private_class_method. For consistency, >shouldn't there also be #protected_class_method." This was my second question. >So my suggestion would be to rename the two methods in question as >something like: > >Module#public_class_method => Module#make_methods_public >=> Module#publicize_methods > >Module#private_class_method => Module#make_methods_private >=> Module#privatize_methods > My opinion is that the change of scope should be kept/indicated. Your proposals should include 'class' somewhere. >(I'm not sure if I like the method name to use "methods" or "method", >given that it can take more than one argument.) In my opinion, class_private, class_public, and class_protected names have the following benefits : - they are very close to the private, public and protected methods. - they cover one or multiple arguments But similar names will also be great ! --------------------------------- Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. --0-316030708-1174584879=:23815--