Class: FiberRecycling::RootFiberBackend

Inherits:
FiberBackend show all
Defined in:
lib/fiber_recycling/root_fiber_backend.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRootFiberBackend

Returns a new instance of RootFiberBackend.



10
11
12
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 10

def initialize
  @variables = {}
end

Instance Attribute Details

#variablesObject (readonly)

Returns the value of attribute variables.



8
9
10
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 8

def variables
  @variables
end

Class Method Details

.yield(*args) ⇒ Object

Raises:



4
5
6
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 4

def self.yield(*args)
  raise FiberError, "can't yield from root fiber"
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 14

def alive?
  ::Fiber.root.alive?
end

#inspectObject



18
19
20
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 18

def inspect
  ::Fiber.root.inspect
end

#resume(*args) ⇒ Object



22
23
24
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 22

def resume(*args)
  ::Fiber.root.resume(*args)
end

#to_sObject



26
27
28
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 26

def to_s
  "#<RecycledFiber::Fiber:#{object_hexid}>"
end

#transfer(*args) ⇒ Object



30
31
32
# File 'lib/fiber_recycling/root_fiber_backend.rb', line 30

def transfer(*args)
  ::Fiber.root.transfer(*args)
end