module ActiveSupport::ExecutionContext
def set(**options)
Updates the execution context. If a block is given, it resets the provided keys to their
def set(**options) options.symbolize_keys! keys = options.keys store = self.store previous_context = keys.zip(store.values_at(*keys)).to_h store.merge!(options) @after_change_callbacks.each(&:call) if block_given? begin yield ensure store.merge!(previous_context) @after_change_callbacks.each(&:call) end end end