module ActiveSupport::IsolatedExecutionState

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/active_support/isolated_execution_state.rbs

module ActiveSupport::IsolatedExecutionState
  def []: ((Symbol | String) key) -> (nil | Array[ActiveSupport::Notifications::Event] | ActiveSupport::TaggedLogging::TagStack)
  def context: () -> Thread
end

def [](key)

Experimental RBS support (using type sampling data from the type_fusion project).

def []: ((Symbol | String) key) -> (nil | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::Notifications::Event | ActiveSupport::TaggedLogging::TagStack)

This signature was generated using 4 samples from 1 application.

def [](key)
  state[key]
end

def []=(key, value)

def []=(key, value)
  state[key] = value
end

def clear

def clear
  state.clear
end

def context

Experimental RBS support (using type sampling data from the type_fusion project).

def context: () -> Thread

This signature was generated using 3 samples from 1 application.

def context
  scope.current
end

def delete(key)

def delete(key)
  state.delete(key)
end

def isolation_level=(level)

def isolation_level=(level)
  return if level == @isolation_level
  unless %i(thread fiber).include?(level)
    raise ArgumentError, "isolation_level must be `:thread` or `:fiber`, got: `#{level.inspect}`"
  end
  clear if @isolation_level
  @scope =
    case level
    when :thread; Thread
    when :fiber; Fiber
    end
  @isolation_level = level
end

def key?(key)

def key?(key)
  state.key?(key)
end

def share_with(other)

def share_with(other)
  # Action Controller streaming spawns a new thread and copy thread locals.
  # We do the same here for backward compatibility, but this is very much a hack
  # and streaming should be rethought.
  context.active_support_execution_state = other.active_support_execution_state.dup
end

def state

def state
  context.active_support_execution_state ||= {}
end

def unique_id

def unique_id
  self[:__id__] ||= Object.new
end