Module: RactorRailsShim::Storage::ThreadLocal
- Defined in:
- lib/ractor_rails_shim/foundation/storage.rb
Overview
Thread-local fallback: the former FallbackIES body. A per-thread Hash
stored under a well-known key on Thread.current. Provides clear for
spec/parity (not part of the cross-implementation contract).
Constant Summary collapse
- KEY =
:active_support_execution_state_fallback
Class Method Summary collapse
- .[](key) ⇒ Object
- .[]=(key, value) ⇒ Object
- .clear ⇒ Object
- .delete(key) ⇒ Object
- .key?(key) ⇒ Boolean
Class Method Details
.[](key) ⇒ Object
54 55 56 |
# File 'lib/ractor_rails_shim/foundation/storage.rb', line 54 def [](key) Thread.current[KEY]&.[](key) end |
.[]=(key, value) ⇒ Object
58 59 60 |
# File 'lib/ractor_rails_shim/foundation/storage.rb', line 58 def []=(key, value) (Thread.current[KEY] ||= {})[key] = value end |
.clear ⇒ Object
70 71 72 |
# File 'lib/ractor_rails_shim/foundation/storage.rb', line 70 def clear Thread.current[KEY] = nil end |
.delete(key) ⇒ Object
66 67 68 |
# File 'lib/ractor_rails_shim/foundation/storage.rb', line 66 def delete(key) Thread.current[KEY]&.delete(key) end |
.key?(key) ⇒ Boolean
62 63 64 |
# File 'lib/ractor_rails_shim/foundation/storage.rb', line 62 def key?(key) Thread.current[KEY]&.key?(key) end |