Class: GorgonBunny::SystemTimer
- Inherits:
-
Object
- Object
- GorgonBunny::SystemTimer
- Defined in:
- lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
Overview
Used for Ruby before 1.9
Class Method Summary collapse
-
.timeout(seconds, exception = nil) ⇒ Object
Executes a block of code, raising if the execution does not finish in the alloted period of time, in seconds.
Class Method Details
.timeout(seconds, exception = nil) ⇒ Object
Executes a block of code, raising if the execution does not finish in the alloted period of time, in seconds.
10 11 12 13 14 15 16 17 18 |
# File 'lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb', line 10 def self.timeout(seconds, exception = nil) if seconds ::SystemTimer.timeout_after(seconds, exception) do yield end else yield end end |