Ripple::Document does not support cloning at the moment. Note that Object#clone simply copies the instance variables but doesn't clone them (unless the class overrides #initialize_copy to change that behavior).
Sean Cribbs <[email protected]> Developer Advocate Basho Technologies, Inc. http://basho.com/ On Feb 24, 2011, at 5:47 AM, Joshua Partogi wrote: > Hi, > > I cloned a ripple object and change the state of it. Unfortunately it > also change to state of the original object. How is this possible? Am > I doing something wrong? Here is the spec to show the example: > > class Person > include Ripple::Document > > property :name, String > end > > class Dude > attr_accessor :name > end > > describe 'test' do > it "should copy object" do > joe = Person.new > joe.name = 'Joe' > > john = joe.clone > john.name = 'John' > > joe.name.should == 'Joe' > john.name.should == 'John' > > joe = Dude.new > joe.name = 'Joe' > > john = joe.clone > john.name = 'John' > > joe.name.should == 'Joe' > john.name.should == 'John' > > end > end > > The spec will fail when asserting Joe's (Person) name. Please advise > on how I can resolve this problem. > > Thank you for your assistance. > > Kind regards, > Joshua. > > -- > http://twitter.com/jpartogi > > _______________________________________________ > riak-users mailing list > [email protected] > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com _______________________________________________ riak-users mailing list [email protected] http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
