What does class << self mean? <p>Regarding:</p> <pre><code>class Test class &lt;&lt; self def hi puts "Hi there" end end </code></pre> <p>I came up with following image in my head:</p> <p>Since everything is an object in Ruby, classes themselves are objects of class <code>Class</code>. By calling <code>class &lt;&lt; self</code> you open up <code>Class</code> definition from the inside of <code>Test</code> and inject few instance methods. Since <code>Test</code> is an instance of <code>Class</code>, you can call those methods same way you call instance methods on your objects: <code>Test.hi</code>. </p> <p>Following is the pseudo code which helps to visualise my previous sentence:</p> <pre><code>class Class def hi puts “Hi there” end end Test = Class.new(class Test end) Test.hi </code></pre> <p>Am I getting this right?</p>