On Jan 9, 9:35 am, Daniele Antani <daniele.cesar... / gmail.com> wrote: > Hello to all, > > i can't understand the follow behaviour: > > class Player > attr_accessor :hand > def initialize(hand) > @hand = hand > end > end > Why the change affects both objects? I want to copy the first object and > work on the copy without affecting the original. Both Player objects contain a reference to the same array. What you want is this: class Player attr_accessor :hand def initialize(hand) @hand = hand.clone end end