Skip to content

Commit

Permalink
Handle odd numbers of NodeFilters to be configured
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stevehill1981 authored Dec 28, 2023
1 parent 6c9d27e commit 14abefb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/html_pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def call(text, context: {}, result: {})
end
end

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

result
Expand Down

0 comments on commit 14abefb

Please sign in to comment.