module RequestStore

Constants

VERSION

Public Class Methods

[](key) click to toggle source
# File lib/request_store.rb, line 30
def self.[](key)
  store[key]
end
[]=(key, value) click to toggle source
# File lib/request_store.rb, line 38
def self.[]=(key, value)
  store[key] = value
end
active?() click to toggle source
# File lib/request_store.rb, line 22
def self.active?
  Thread.current[:request_store_active] || false
end
begin!() click to toggle source
# File lib/request_store.rb, line 14
def self.begin!
  Thread.current[:request_store_active] = true
end
clear!() click to toggle source
# File lib/request_store.rb, line 10
def self.clear!
  Thread.current[:request_store] = {}
end
delete(key, &block) click to toggle source
# File lib/request_store.rb, line 51
def self.delete(key, &block)
  store.delete(key, &block)
end
end!() click to toggle source
# File lib/request_store.rb, line 18
def self.end!
  Thread.current[:request_store_active] = false
end
exist?(key) click to toggle source
# File lib/request_store.rb, line 42
def self.exist?(key)
  store.key?(key)
end
fetch(key) { || ... } click to toggle source
# File lib/request_store.rb, line 46
def self.fetch(key, &block)
  store[key] = yield unless exist?(key)
  store[key]
end
read(key) click to toggle source
# File lib/request_store.rb, line 26
def self.read(key)
  store[key]
end
store() click to toggle source
# File lib/request_store.rb, line 6
def self.store
  Thread.current[:request_store] ||= {}
end
write(key, value) click to toggle source
# File lib/request_store.rb, line 34
def self.write(key, value)
  store[key] = value
end