#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Duplicare+Un+Oggetto # Check the page for copyright notice and explanations >> s1='ciao' => "ciao" >> s2=s1 => "ciao" >> s1.object_id==s2.object_id => true >> s1='ciao' => "ciao" >> s2=s1.dup => "ciao" >> p s1.object_id, s2.object_id 20905692 20897916 => nil >> s3=s2.clone => "ciao" >> p s1.object_id,s2.object_id,s3.object_id 20905692 20897916 20877096 => nil >> s1== s2 and s2== s3 => true