Fiber::Storage SourceFiberFixBorkedKeys

module FixBorkedKeys

This is a fix for the original implementation of fiber storage which incorrectly handled non-dynamic symbol keys.

Definitions

def [](key)

Lookup the value for the key, ensuring the symbol is dynamic.

Implementation

def [](key)
	raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol)
	
	super(eval(key.inspect))
end

def []=(key, value)

Assign the value to the key, ensuring the symbol is dynamic.

Implementation

def []=(key, value)
	raise TypeError, "Key must be symbol!" unless key.is_a?(Symbol)
	
	super(eval(key.inspect), value)
end