module Temple::Mixins::ThreadOptions

def thread_options

def thread_options
  Thread.current[thread_options_key]
end

def thread_options_key

def thread_options_key
  @thread_options_key ||= "#{self.name}-thread-options".to_sym
end

def with_options(options)

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