On Oct 10, 2006, at 3:55 AM, joevandyk / gmail.com wrote:

> What's the difference between
>
> class Foo
>   class << self
>     def foo; end
>   end
> end

Such definition evals area of code in scope of object self,  
referenced to constant Foo and adds
singleton methods to it.


> class Foo
>   def self.foo; end
> end

Such definition creates a singleton method on object self, which is  
equal to constant Foo in this scope.