Skip to content

Commit

Permalink
fix: restore context after block.call
Browse files Browse the repository at this point in the history
If return is called in the with_context block, the context cannot be restored to its original state.
The "ensure" clause call post-processing even if it called returned in the middle of block.call.
  • Loading branch information
iberianpig committed Jan 27, 2024
1 parent 8d70616 commit 606b17d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/fusuma/config/searcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class << self
def with_context(context, &block)
@context = context || {}
result = block.call
ensure # NOTE: ensure is called even if return in block
@context = {}
result
end
Expand Down

0 comments on commit 606b17d

Please sign in to comment.