title: Ruby Class method or Constant, best practice
body: <p>One of my ruby classes draws data from a rather large, local, XML file that will only change with a new deploy.</p>
  
  <p>Is the best practice in this case to keep the document as a constant, like:</p>
  
  <pre><code>class Product 
    XML_DOC = Nokogiri::XML(open("#{Rails.root}/myxmlfile.xml"))
  end
  </code></pre>
  
  <p>or to access the document through a class method, like:</p>
  
  <pre><code>class Product 
   self.xml_doc
      Nokogiri::XML(open("#{Rails.root}/myxmlfile.xml"))
    end
  end
  </code></pre>
  
  <p>I think that the class method may be the way to go, since it will be easier to mock in tests, but what's considered the best-practice for keeping an in-memory file like this?</p>