class FrozenRecord::Base::ThreadSafeStorage

Public Class Methods

new(key) click to toggle source
# File lib/frozen_record/base.rb, line 42
def initialize(key)
  @thread_key = "#{ self.object_id }-#{ key }"
end

Public Instance Methods

[](key) click to toggle source
# File lib/frozen_record/base.rb, line 46
def [](key)
  Thread.current[@thread_key] ||= {}
  Thread.current[@thread_key][key]
end
[]=(key, value) click to toggle source
# File lib/frozen_record/base.rb, line 51
def []=(key, value)
  Thread.current[@thread_key] ||= {}
  Thread.current[@thread_key][key] = value
end