Module: Fiber::FixBorkedKeys
- Included in:
- Fiber
- Defined in:
- lib/fiber/storage.rb
Overview
This is a fix for the original implementation of fiber storage which incorrectly handled non-dynamic symbol keys.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Lookup the value for the key, ensuring the symbol is dynamic.
-
#[]=(key, value) ⇒ Object
Assign the value to the key, ensuring the symbol is dynamic.
Instance Method Details
#[](key) ⇒ Object
Lookup the value for the key, ensuring the symbol is dynamic.
72 73 74 75 76 |
# File 'lib/fiber/storage.rb', line 72 def [](key) raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol) super(eval(key.inspect)) end |
#[]=(key, value) ⇒ Object
Assign the value to the key, ensuring the symbol is dynamic.
79 80 81 82 83 |
# File 'lib/fiber/storage.rb', line 79 def []=(key, value) raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol) super(eval(key.inspect), value) end |