title: Ruby instance_eval on a class with attr_accessor
body: <p>I understand the basic difference between <code>instance_eval</code> and <code>class_eval</code>. What I've discovered though when playing around is something strange involving <code>attr_accessor</code>. Here's an example:</p>
  
  <pre><code>A = Class.new
  A.class_eval{ attr_accessor :x }
  
  a = A.new
  a.x = "x"
  a.x
  =&gt; "x"  # ... expected
  
  A.instance_eval{ attr_accessor :y }
  
  A.y = "y"
  =&gt; NoMethodError: undefined method `y=' for A:Class
  
  a.y = "y"
  =&gt; "y"      # WHATTT?
  </code></pre>
  
  <p>How is it that:</p>
  
  <ol>
  <li>the instance_eval didn't at the accessor onto our A class (object)</li>
  <li>it then in fact added it onto instances of A?</li>
  </ol>