Skip to content

Commit

Permalink
fix: save and restore context after block.call
Browse files Browse the repository at this point in the history
  • Loading branch information
iberianpig committed Jan 29, 2024
1 parent 5bceddd commit e2873b3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/fusuma/config/searcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ class << self
# Search with context from load_streamed Config
# @param context [Hash]
# @return [Object]
def with_context(context, &block)
@context = context || {}
def with_context(context = {}, &block)
before = @context
@context = context
result = block.call
ensure # NOTE: ensure is called even if return in block
@context = {}
@context = before
result
end

Expand Down

0 comments on commit e2873b3

Please sign in to comment.