Module: Temple::Mixins::ThreadOptions

Defined in:
lib/temple/mixins/options.rb

Instance Method Summary collapse

Instance Method Details

#thread_optionsObject



59
60
61
# File 'lib/temple/mixins/options.rb', line 59

def thread_options
  Thread.current[thread_options_key]
end

#with_options(options) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/temple/mixins/options.rb', line 51

def with_options(options)
  old_options = thread_options
  Thread.current[thread_options_key] = ImmutableMap.new(options, thread_options)
  yield
ensure
  Thread.current[thread_options_key] = old_options
end