Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
TreeNode#add side effect leads to inconsistency #32
If a TreeNode n with parent p within a tree t1 is added as a child of p' within another tree t2, then n remains a child of p within t1 but inconsistently reports its parent to be p' (by calling TreeNode#parent).
I suggest to change behavior in one of the following two ways:
t2 = t1.dup
t2['3'] << t1['2']['4']
t1['2']['4'].parent.name # => '3' !