title: Why can't I refer to DATA in class context?
body: <p>In Ruby it's really handy to store static text after <code>__END__</code> for arbitrary use via the <code>DATA</code> IO object:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>puts DATA.read # Prints "This is the stuff!"
  __END__
  This is the stuff!
  </code></pre>
  
  <p>However, when I try to reference the DATA object from the context of a new class I get unexpected errors (in Ruby 1.9.3 and 2.0, apparently):</p>
  
  <pre class="lang-ruby prettyprint-override"><code>class Foo
    STUFF = DATA.read # &lt;class:Foo&gt;: uninitialized constant Foo::DATA (NameError)
  end
  
  class Foo
    STUFF = ::DATA.read # &lt;class:Foo&gt;: uninitialized constant DATA (NameError)
  end
  </code></pre>
  
  <p>Any idea how I could make this work?</p>