Class: Isolator::ThreadStateProxy
- Inherits:
-
Object
- Object
- Isolator::ThreadStateProxy
- Defined in:
- lib/isolator.rb
Instance Attribute Summary collapse
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(prefix = "isolator_") ⇒ ThreadStateProxy
constructor
A new instance of ThreadStateProxy.
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
#prefix ⇒ Object (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 |