Skip to content

Commit de1f313

Browse files
authored
Update changelog for recent InspectionTree change (#231)
Recently, InspectionTree was changed so that it no longer `instance_eval`'s the block that it takes. This change was released in 0.11.0, but should have been marked as a breaking change, since it affects custom InspectionTreeBuilders. Although we can't go back and change 0.11.0, we can at least document this for future code spelunkers.
1 parent fc418c1 commit de1f313

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

CHANGELOG.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22

33
## 0.11.0 - 2024-02-10
44

5+
### BREAKING CHANGES
6+
7+
- Change InspectionTree so that it no longer `instance_eval`s the block it
8+
takes. ([#210](https://github.com/mcmire/super_diff/issues/210))
9+
- If you have a custom InspectionTreeBuilder, you will need to change your
10+
`call` method so that instead of looking like this:
11+
```ruby
12+
def call
13+
SuperDiff::ObjectInspection::InspectionTree.new do
14+
as_lines_when_rendering_to_lines(collection_bookend: :open) do
15+
add_text object.inspect
16+
end
17+
end
18+
end
19+
```
20+
it looks something like this instead:
21+
```ruby
22+
def call
23+
SuperDiff::ObjectInspection::InspectionTree.new do |t1|
24+
t1.as_lines_when_rendering_to_lines(collection_bookend: :open) do |t2|
25+
t2.add_text object.inspect
26+
end
27+
end
28+
end
29+
```
30+
Note that the following methods yield a new InspectionTree, so the tree
31+
needs to be given a new name each time. It is conventional to use `t1`,
32+
`t2`, etc.:
33+
- `as_lines_when_rendering_to_lines`
34+
- `as_prefix_when_rendering_to_lines`
35+
- `as_prelude_when_rendering_to_lines`
36+
- `as_single_line`
37+
- `nested`
38+
- `only_when`
39+
- `when_empty`
40+
- `when_non_empty`
41+
- `when_rendering_to_lines`
42+
- `when_rendering_to_string`
43+
544
### Features
645

746
- Add inspector for RSpec describable matchers not otherwise handled by an
@@ -25,8 +64,6 @@
2564

2665
### Improvements
2766

28-
- Change InspectionTree so that it no longer `instance_eval`s the block it
29-
takes. ([#210](https://github.com/mcmire/super_diff/issues/210))
3067
- Improve wording in `raise_error` failure messages.
3168
([#218](https://github.com/mcmire/super_diff/issues/218))
3269

0 commit comments

Comments
 (0)