class ScopedStorage::ThreadLocalStorage

Attributes

data[RW]

Public Class Methods

for(scope_name="default") click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 9
def self.for(scope_name="default")
  Thread.current["_#{name}_#{scope_name}"] ||= new
end
new() click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 13
def initialize
  self.data||={}
end

Public Instance Methods

[](key) click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 21
def [](key)
  self.data[key]
end
[]=(key, value) click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 17
def []=(key, value)
  self.data[key]=value
end
clear!() click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 25
def clear!
  self.data.clear
end
fetch(*args, &block) click to toggle source
# File lib/scoped_storage/thread_local_storage.rb, line 29
def fetch(*args, &block)
  self.data.fetch(*args, &block)
end