Sha256: cda862853a8b7a731ae4f0422e7979367ee31240f791bc41c2bb38ff5ae9a3ec

Contents?: true

Size: 467 Bytes

Versions: 28

Compression:

Stored size: 467 Bytes

Contents

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

require "system_timer"

module Bunny
  # 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)
      if seconds
        ::SystemTimer.timeout_after(seconds, exception) do
          yield
        end
      else
        yield
      end
    end
  end # SystemTimer
end # Bunny

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
bunny-1.0.0.rc2 lib/bunny/system_timer.rb
bunny-0.10.8 lib/bunny/system_timer.rb
bunny-1.0.0.rc1 lib/bunny/system_timer.rb
bunny-0.10.7 lib/bunny/system_timer.rb
bunny-0.10.6 lib/bunny/system_timer.rb
bunny-1.0.0.pre6 lib/bunny/system_timer.rb
bunny-0.10.5 lib/bunny/system_timer.rb
bunny-1.0.0.pre5 lib/bunny/system_timer.rb
bunny-0.10.4 lib/bunny/system_timer.rb
bunny-0.10.3 lib/bunny/system_timer.rb
bunny-1.0.0.pre4 lib/bunny/system_timer.rb
bunny-0.10.2 lib/bunny/system_timer.rb
bunny-0.10.1 lib/bunny/system_timer.rb
bunny-0.10.0 lib/bunny/system_timer.rb
bunny-1.0.0.pre3 lib/bunny/system_timer.rb
bunny-0.9.8 lib/bunny/system_timer.rb
bunny-1.0.0.pre2 lib/bunny/system_timer.rb
bunny-0.9.7 lib/bunny/system_timer.rb
bunny-0.9.6 lib/bunny/system_timer.rb
bunny-0.9.5 lib/bunny/system_timer.rb