Module: FiberRecycling::ThreadExtensions

Included in:
Thread
Defined in:
lib/fiber_recycling/thread_extensions.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/fiber_recycling/thread_extensions.rb', line 4

def [](key)
  if key == :fiber_recycling__fiber || Fiber.root?
    super
  else
    Fiber.current.variables[key]
  end
end

#[]=(key, value) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/fiber_recycling/thread_extensions.rb', line 12

def []=(key, value)
  if key == :fiber_recycling__fiber || Fiber.root?
    super
  else
    Fiber.current.variables[key] = value
  end
end