On 10/2/05, David A. Black <dblack / wobblini.net> wrote:
> Hi --
>
> On Mon, 3 Oct 2005, Mark Volkmann wrote:
>
> > These seem to be identical. Are they?
> >
> > class Foo
> >  def Foo.bar
> >    # some code
> >  end
> > end
> >
> > class Foo
> >  def self.bar
> >    # some code
> >  end
> > end
> >
> > If they are identical, is one form generally preferred over the other?
>
> The advantage of the self version is that it might be a little easier
> to maintain (e.g., if you change the name of the class).
>
> > So a "class method" is the same as a "singleton method" on a Class object?
>
> Basically, yes.  I think the main difference is that they have a bit
> of language-level "special case" status.  There's the class_methods
> method, which makes them "official".

Did you mean the singleton_methods method?  I don't see a method named
class_methods anywhere.

--
R. Mark Volkmann
Partner, Object Computing, Inc.