Exception: Toolshed::Timeout::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Toolshed::Timeout::Error
- Defined in:
- lib/toolshed/timeout.rb
Overview
Raised by Timeout#timeout when the block times out.
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
74 75 76 |
# File 'lib/toolshed/timeout.rb', line 74 def thread @thread end |
Class Method Details
.catch(*args) ⇒ Object
76 77 78 79 80 |
# File 'lib/toolshed/timeout.rb', line 76 def self.catch(*args) exc = new(*args) exc.instance_variable_set(:@thread, Thread.current) ::Kernel.catch(exc) {yield exc} end |
Instance Method Details
#exception ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/toolshed/timeout.rb', line 82 def exception(*) # TODO: use Fiber.current to see if self can be thrown if self.thread == Thread.current bt = caller begin throw(self, bt) rescue UncaughtThrowError end end self end |