Mr. Google helped me. I just asked "ruby copy object" and he showed me
(narrow) path that led to
http://www.rubygarden.org/ruby?Make_A_Deep_Copy_Of_An_Object

I added this to class Page and got what I needed!

def deep_clone
  Marshal::load(Marshal.dump(self))
end

#<Page:0x4c1dae8 @url="app.com/view.aspx", @texts=["File > View"]>
#<Page:0x4c1da28 @url="app.com/view.aspx", @texts=["File > View",
"File added."]>
#<Page:0x4c1d920 @url="app.com/view.aspx", @texts=["File > View",
"File edited."]>

Thanks for Object#clone, it showed me the way.

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to