title: What's the difference between Ruby's dup and clone methods?
body: <p>The <a href="http://www.ruby-doc.org/core-2.0/Object.html#method-i-dup" rel="noreferrer">Ruby docs for <code>dup</code></a> say:</p>
  
  <blockquote>
    <p>In general, <code>clone</code> and <code>dup</code> may have different semantics in descendent classes. While <code>clone</code> is used to duplicate an object, including its internal state, <code>dup</code> typically uses the class of the descendent object to create the new instance.</p>
  </blockquote>
  
  <p>But when I do some test I found they are actually the same:</p>
  
  <pre><code>class Test
     attr_accessor :x
  end
  
  x = Test.new
  x.x = 7
  y = x.dup
  z = x.clone
  y.x =&gt; 7
  z.x =&gt; 7
  </code></pre>
  
  <p>So what are the differences between the two methods?</p>