From e7da1ddd6172fa36a8c0159652111b11745c81da Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Thu, 14 Feb 2019 17:32:39 +0900 Subject: Eliminate a thread local variable as suggested by nobu --- .../lib/active_support/core_ext/string/output_safety.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index 55579ec259..1371abbc4a 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -287,14 +287,7 @@ module ActiveSupport #:nodoc: end def set_block_back_references(block, match_data) - Thread.current[:__active_support_safe_buffer_backref] = match_data - begin - block.binding.eval(<<-EOC) - $~ = Thread.current[:__active_support_safe_buffer_backref] - EOC - ensure - Thread.current[:__active_support_safe_buffer_backref] = nil - end + block.binding.eval("proc { |m| $~ = m }").call(match_data) end end end -- cgit v1.2.3