module RequestStore
Constants
- VERSION
Public Class Methods
[](key)
click to toggle source
# File lib/request_store.rb, line 18 def self.[](key) store[key] end
[]=(key, value)
click to toggle source
# File lib/request_store.rb, line 26 def self.[]=(key, value) store[key] = value end
clear!()
click to toggle source
# File lib/request_store.rb, line 10 def self.clear! Thread.current[:request_store] = {} end
exist?(key)
click to toggle source
# File lib/request_store.rb, line 30 def self.exist?(key) store.key?(key) end
fetch(key) { || ... }
click to toggle source
# File lib/request_store.rb, line 34 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 14 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 22 def self.write(key, value) store[key] = value end