diff options
author | Shugo Maeda <shugo@ruby-lang.org> | 2019-02-14 17:32:39 +0900 |
---|---|---|
committer | Shugo Maeda <shugo@ruby-lang.org> | 2019-02-14 17:32:39 +0900 |
commit | e7da1ddd6172fa36a8c0159652111b11745c81da (patch) | |
tree | c4ee4afa1cf891f04810190c847b5f6188c64484 /activesupport/lib/active_support | |
parent | cd40043357491f386a4e3dd095ed4ad6abb54f81 (diff) | |
download | rails-e7da1ddd6172fa36a8c0159652111b11745c81da.tar.gz rails-e7da1ddd6172fa36a8c0159652111b11745c81da.tar.bz2 rails-e7da1ddd6172fa36a8c0159652111b11745c81da.zip |
Eliminate a thread local variable as suggested by nobu
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 9 |
1 files changed, 1 insertions, 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 |