Class: Isolator::ThreadStateProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/isolator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix = "isolator_") ⇒ ThreadStateProxy

Returns a new instance of ThreadStateProxy.



23
24
25
# File 'lib/isolator.rb', line 23

def initialize(prefix = "isolator_")
  @prefix = prefix
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



21
22
23
# File 'lib/isolator.rb', line 21

def prefix
  @prefix
end

Instance Method Details

#[](key) ⇒ Object



27
28
29
# File 'lib/isolator.rb', line 27

def [](key)
  Thread.current[:"#{prefix}#{key}"]
end

#[]=(key, value) ⇒ Object



31
32
33
# File 'lib/isolator.rb', line 31

def []=(key, value)
  Thread.current[:"#{prefix}#{key}"] = value
end