Sha256: 31066c26915a251d413422a16a974ea1def28ceb2ae9d338a70787ca9da87d61

Contents?: true

Size: 485 Bytes

Versions: 28

Compression:

Stored size: 485 Bytes

Contents

# -*- encoding: utf-8; mode: ruby -*-

require "system_timer"

module GorgonBunny
  # Used for Ruby before 1.9
  class SystemTimer
    # Executes a block of code, raising if the execution does not finish
    # in the alloted period of time, in seconds.
    def self.timeout(seconds, exception = nil)
      if seconds
        ::SystemTimer.timeout_after(seconds, exception) do
          yield
        end
      else
        yield
      end
    end
  end # SystemTimer
end # GorgonBunny

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gorgon-0.6.5 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.4 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.3 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.2 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.1 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.0 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.0.rc2 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb
gorgon-0.6.0.rc1 lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb