I use the suggested Marshall way: Marshal::load(Marshal::dump(self)) and it's working as I wanted. Thanks for the help! Raph Raphael Bauduin wrote: > Hi, > > I'd like to duplicate n object, work on the copy, and be sure the original > isn't change at all. How can I do that? > > From the pickaxe (example similar to what I'm working on): > > class Klass > attr_accessor :str > end > > s1 = Klass.new > => #<Klass:0x4031ad18> > s1.str = "Hello" > => "Hello" > s2 = s1.dup > => #<Klass:0x4030fcb0 @str="Hello"> > s2.str[1,4] = "i" > => "i" > > s1.str > => "Hi" > > s2.str > => "Hi" > > I would like that s1.str still returns "Hello". I tried with dup and clone, > with the same result.... What method should I use? > > Thanks > > Raph