Exception: Timeout::ExitException
- Inherits:
-
Exception
- Object
- Exception
- Timeout::ExitException
- Defined in:
- lib/timeout.rb
Overview
:nodoc:
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
29 30 31 |
# File 'lib/timeout.rb', line 29 def thread @thread end |
Class Method Details
.catch(*args) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/timeout.rb', line 31 def self.catch(*args) exc = new(*args) exc.instance_variable_set(:@thread, Thread.current) exc.freeze ::Kernel.catch(exc) {yield exc} end |
Instance Method Details
#exception ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/timeout.rb', line 38 def exception(*) if self.thread == Thread.current bt = caller begin throw(self, bt) rescue ArgumentError => e raise unless e..start_with?("uncaught throw") raise Error, , backtrace end end self end |