uses of "self" ?

When does "self" refer to an instance of the class or object, when is it
a user object and when is it used to define a class method? What's the
difference?

When does "self" refer to an instance of the class or object, when is it
a user object and when is it used to define a class method? What's the
difference?

I don't think the distinction you mention exists. If self is SomeClass then def self.foo is the same as def SomeClass.foo, just more convenient.

Fred

When does "self" refer to an instance of the class or object, when is it
a user object and when is it used to define a class method? What's the
difference?

If you really want to dig into it, I'd highly recommend The Well-Grounded Rubyist. Chapter 5 in particular.

http://www.manning.com/black2/

No affiliation other than I was lucky enough to review it. Good stuff.

-philip