Skip to content

Commit a7a0ab4

Browse files
committed
Document 2.2.0 API changes
Add a new 2.2.0 section covering recent behavior changes in tree operations and traversal, plus link references for the new entries.
1 parent ec6ab3b commit a7a0ab4

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

API-CHANGES.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ _Note_: API changes are expected to reduce significantly after the `1.x`
77
release. In most cases, an alternative will be provided to ensure relatively
88
smooth transition to the new APIs.
99

10+
## Release 2.2.0 Changes
11+
12+
* [Tree::TreeNode#add][add] now raises `ArgumentError` when attempting to add
13+
an ancestor node as a child, preventing cycles.
14+
15+
* [Tree::TreeNode#remove_all!][remove_all] now detaches children by clearing
16+
their parent links.
17+
18+
* [Tree::TreeNode#rename_child][rename_child] now raises `ArgumentError` if the
19+
new name collides with an existing sibling.
20+
21+
* [Tree::BinaryTreeNode#set_child_at][set_child_at] now raises `ArgumentError`
22+
for invalid indices and cleans up parent/hash references when replacing or
23+
clearing a child.
24+
25+
* [Tree::TreeNode#postordered_each][postordered_each] and
26+
[Tree::TreeNode#breadth_each][breadth_each] now skip `nil` children to
27+
support binary trees with missing children.
28+
29+
* [Tree::TreeNode#each_level][each_level] now returns a level-wise enumerator
30+
when called without a block.
31+
1032
## Release 2.1.0 Changes
1133

1234
* Minimum Ruby version has been bumped to 2.7 and above
@@ -143,6 +165,7 @@ smooth transition to the new APIs.
143165
[detached_subtree_copy]: rdoc-ref:Tree::TreeNode#detached_subtree_copy
144166
[dup]: rdoc-ref:Tree::TreeNode#dup
145167
[each]: rdoc-ref:Tree::TreeNode#each
168+
[each_level]: rdoc-ref:Tree::TreeNode#each_level
146169
[in_degree]: rdoc-ref:Tree::Utils::TreeMetricsHandler#in_degree
147170
[initialize]: rdoc-ref:Tree::TreeNode#initialize
148171
[inordered_each]: rdoc-ref:Tree::BinaryTreeNode#inordered_each
@@ -155,5 +178,8 @@ smooth transition to the new APIs.
155178
[postordered_each]: rdoc-ref:Tree::TreeNode#postordered_each
156179
[preordered_each]: rdoc-ref:Tree::TreeNode#preordered_each
157180
[previous_sibling]: rdoc-ref:Tree::TreeNode#previous_sibling
181+
[remove_all]: rdoc-ref:Tree::TreeNode#remove_all!
182+
[rename_child]: rdoc-ref:Tree::TreeNode#rename_child
183+
[set_child_at]: rdoc-ref:Tree::BinaryTreeNode#set_child_at
158184
[siblings]: rdoc-ref:Tree::TreeNode#siblings
159185
[to_json]: rdoc-ref:Tree::Utils::JSONConverter#to_json

0 commit comments

Comments
 (0)