Background here.
In the above link, the following example is given:
class << self
def by_author(author)
where(:author_id => author.id)
end
The following two bits of code are equivalent.
Using self.method
:
class Hello
def self.world
puts "Hello, World!"
end
end
Using class << self
:
class Hello
class << self
def world
puts "Hello, World!"
end
end
end
The only difference is readability, as well as the ease in refactoring.
The class << self
technique is often used when metaprogramming.
There is another thread that explains this. class << self vs self.method with Ruby: what's better?