Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While using RubyTree at work I noticed that the node names, though the documentation states "The node name is expected to be unique within the tree.", are not unique if you add an already added node/name to another child. There are several ways to fix this, the easiest implementation, is to check if the tree, where the child is added too, already contains a node with this name.
Because I'm not allowed to spend too much worktime on open source projects I stuck with the simple implementation I mentioned and hope that this is of any use to you anyway. While testing, the "add node to self as child" case was fixed too so I changed the test likewise.
Adding a node might still be exploitable by something like this, I hope you get the idea, could happen anytime you add a node or merge two trees:
Thanks a lot for RubyTree and best regards, ysf :)