From 606b17dd300d6a65edc94bbea4c402e767f23a93 Mon Sep 17 00:00:00 2001 From: iberianpig Date: Sat, 27 Jan 2024 13:48:41 +0900 Subject: [PATCH] fix: restore context after block.call 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. --- lib/fusuma/config/searcher.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/fusuma/config/searcher.rb b/lib/fusuma/config/searcher.rb index b82e052..3367882 100644 --- a/lib/fusuma/config/searcher.rb +++ b/lib/fusuma/config/searcher.rb @@ -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