Sha256: 773cbf99f6ce6b74c464b70bd834067e22e53d2a28007220d24862f3252ea886

Contents?: true

Size: 473 Bytes

Versions: 43

Compression:

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
bunny-1.7.1 lib/bunny/system_timer.rb
bunny-2.0.0.rc1 lib/bunny/system_timer.rb
bunny-1.7.0 lib/bunny/system_timer.rb
bunny-1.6.3 lib/bunny/system_timer.rb
bunny-1.6.2 lib/bunny/system_timer.rb
bunny-1.6.1 lib/bunny/system_timer.rb
bunny-1.6.0 lib/bunny/system_timer.rb
bunny-1.5.1 lib/bunny/system_timer.rb
bunny-1.6.0.rc2 lib/bunny/system_timer.rb
bunny-1.6.0.rc1 lib/bunny/system_timer.rb
bunny-1.6.0.pre1 lib/bunny/system_timer.rb
bunny-1.5.0 lib/bunny/system_timer.rb
bunny-1.5.0.pre2 lib/bunny/system_timer.rb
bunny-1.5.0.pre1 lib/bunny/system_timer.rb
bunny-1.4.1 lib/bunny/system_timer.rb
bunny-1.4.0 lib/bunny/system_timer.rb
bunny-1.3.1 lib/bunny/system_timer.rb
bunny-1.3.0 lib/bunny/system_timer.rb
bunny-1.2.2 lib/bunny/system_timer.rb
bunny-1.2.1 lib/bunny/system_timer.rb