Skip to content

Commit 14abefb

Browse files
Handle odd numbers of NodeFilters to be configured
The previous method of merging the results from the NodeFilter instances was breaking because Ruby was treating it as a series of 2-element arrays. If you had 0, 1 or 2 node filters configured, it would work fine; if you added a third, it would break with an `ArgumentError`. Adding a fourth makes it work again. Fixes #388
1 parent 6c9d27e commit 14abefb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/html_pipeline.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def call(text, context: {}, result: {})
178178
end
179179
end
180180

181-
result = result.merge(Hash[*@node_filters.collect(&:result).flatten])
181+
@node_filters.collect(&:result).reduce(result, :merge)
182182
@node_filters.each(&:reset!)
183183

184184
result

0 commit comments

Comments
 (0)