Gavin Kistner
3/22/2007 3:52:00 PM
From: Ruby Admirer [mailto:ruby_admirer@yahoo.com]
> Sent: Thursday, March 22, 2007 9:29 AM
> >John Joyce <dangerwillrobinsondanger@gmail.com> wrote:
>
> >You mean you want Java or C++ or something else.
> >It's Ruby.
>
> I don't really understand what you mean.
> Please, read again my post.
> I love Ruby (my pseudo is Ruby Admirer) and public_class_method and
> private_class_method are already parts of Ruby !
No, they're not:
C:\>irb
irb(main):001:0> Object.public_class_methods
NoMethodError: undefined method `public_class_methods' for
Object:Class
from (irb):1
irb(main):002:0> Object.private_class_methods
NoMethodError: undefined method `private_class_methods' for
Object:Class
from (irb):2
C:\>irb -v
irb 0.9.5(05/04/13)
C:\>ruby -v
ruby 1.8.5 (2006-08-25) [i386-mswin32]
Maybe you're thinking of some module or library in Ruby on Rails? (I
don't know if it includes those methods or not.)
> I completely agree. My first question was indeed why public, protected,
> private "statement" (they are in fact methods) does not work for class
> methods ?
'Class' methods, like 'class' instance variables, are no different
from normal methods and instance variables. They are just defined in a
different scope.