RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

The differences between dup and clone in Ruby

I just wrote a quick explanation with examples of the differences between copying and cloning a Ruby object. I've also added a quick explanation of shallow object copying.

Comments

AWESOME. I had no idea clone copied singleton class and dup didn't. That matters. If you submitted a doc patch to MRI to actually document this in Object#dup and Object#clone, that'd be super kind!jrochkind - August 01, 2012 00:23

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!