Class: ThreadAttrAccessor::ThreadStorage
- Inherits:
-
Object
- Object
- ThreadAttrAccessor::ThreadStorage
- Defined in:
- lib/thread_attr_accessor.rb
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #has_key?(key) ⇒ Boolean
-
#initialize(thread) ⇒ ThreadStorage
constructor
A new instance of ThreadStorage.
Constructor Details
#initialize(thread) ⇒ ThreadStorage
Returns a new instance of ThreadStorage.
58 59 60 |
# File 'lib/thread_attr_accessor.rb', line 58 def initialize(thread) @thread = thread end |
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
57 58 59 |
# File 'lib/thread_attr_accessor.rb', line 57 def thread @thread end |
Instance Method Details
#[](key) ⇒ Object
62 63 64 |
# File 'lib/thread_attr_accessor.rb', line 62 def [](key) thread.thread_variable_get(key) end |
#[]=(key, value) ⇒ Object
66 67 68 |
# File 'lib/thread_attr_accessor.rb', line 66 def []=(key, value) thread.thread_variable_set(key, value) end |
#has_key?(key) ⇒ Boolean
70 71 72 |
# File 'lib/thread_attr_accessor.rb', line 70 def has_key?(key) !!thread.thread_variable_get(key) end |