class Fiber
Public Class Methods
await(*a, &b)
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 39 def await(*a, &b) Fibre::Scope.in_scope? ? Fibre::Scope.await(*a, &b) : await_only(*a, &b) end
await_only() { |current| ... }
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 50 def await_only yield(Fiber.current) if block_given? Fiber.yield! end
scope(*a, &b)
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 35 def scope(*a, &b) Fibre::Scope.scope(*a, &b) end
yield!()
click to toggle source
raise exception if we catch exception
# File lib/fibre/core_ext/fiber.rb, line 44 def yield! Fiber.yield.tap do |y| raise y if y.is_a?(Exception) end end
Public Instance Methods
[](key)
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 21 def [](key) attributes[key] end
[]=(key,value)
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 25 def []=(key,value) attributes[key] = value end
attributes()
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 13 def attributes @attributes ||= {} end
leave(exception, message=nil)
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 29 def leave(exception, message=nil) resume exception.is_a?(Class) ? exception.new(message) : exception end
root?()
click to toggle source
# File lib/fibre/core_ext/fiber.rb, line 17 def root? self.eql? Fibre.root end