class Core::Local::Store

public

Simple key/value store, localized to a thread or fiber.

Public Class Methods

new() click to toggle source
# File lib/core/local/store.rb, line 15
def initialize
  @key = :"__corerb_localized_state_#{object_id}"
end

Public Instance Methods

cleanup(key) click to toggle source
public

Returns a proc that, when called, deletes the key from the global store.

# File lib/core/local/store.rb, line 21
def cleanup(key)
  proc { delete(key) }
end

Private Instance Methods

state() click to toggle source
public

Returns all the state for the current thread or fiber.

# File lib/core/local/store.rb, line 27
        def state
  Thread.current[@key] ||= {}
end