title: When to use a module, and when to use a class
body: <p>I am currently working through the Gregory Brown <a href="http://rubybestpractices.com/" rel="noreferrer">Ruby Best Practices</a> book. Early on, he is talking about refactoring some functionality from helper methods on a related class, to some methods on module, then had the module <code>extend self</code>. </p>
  
  <p>Hadn't seen that before, after a quick google, found out that <code>extend self</code> on a module lets methods defined on the module see each other, which makes sense.</p>
  
  <p>Now, my question is when would you do something like this</p>
  
  <pre><code>module StyleParser
    extend self
  
    def process(text)
      ...
    end
  
    def style_tag?(text)
      ...
    end
  end
  </code></pre>
  
  <p>and then refer to it in tests with </p>
  
  <pre><code>@parser = Prawn::Document::Text::StyleParser
  </code></pre>
  
  <p>as opposed to something like this?</p>
  
  <pre><code>class StyleParser
  
    def self.process(text)
      ...
    end
  
    def self.style_tag?(text)
      ...
    end
  end 
  </code></pre>
  
  <p>is it so that you can use it as a mixin? or are there other reasons I'm not seeing?</p>