title: Private module methods in Ruby
body: <p>I have a two part question</p>
  
  <p><strong>Best-Practice</strong></p>
  
  <ul>
  <li>I have an algorithm that performs some operation on a data structure using the public interface</li>
  <li>It is currently a module with numerous static methods, all private except for the one public interface method.</li>
  <li>There is one instance variable that needs to be shared among all the methods.</li>
  </ul>
  
  <p>These are the options I can see, which is the best?:</p>
  
  <ul>
  <li><strong>Module</strong> with static ('module' in ruby) methods </li>
  <li><strong>Class</strong> with static methods</li>
  <li><strong>Mixin</strong> module for inclusion into the data structure</li>
  <li><strong>Refactor</strong> out the part of the algorithm that modifies that data structure (very small) and make that a mixin that calls the static methods of the algorithm module</li>
  </ul>
  
  <p><strong>Technical part</strong></p>
  
  <p>Is there any way to make a <strong>private Module method</strong>?</p>
  
  <pre><code>module Thing
    def self.pub; puts "Public method"; end
    private
    def self.priv; puts "Private method"; end
  end
  </code></pre>
  
  <p><strong>The <code>private</code> in there doesn't seem to have any effect</strong>, I can still call <code>Thing.priv</code> without issue.</p>