Sha256: ef022f7aef1bcea9e948a0d92d359d7e706eb332835134778a829832039f2795

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

$:.unshift File.join(File.basename(__FILE__), "../lib")
require 'rolling_timeout'

begin
	RollingTimeout.new(1) {|timer|
		sleep(0.5)
		puts "slept for 0.5 seconds"
		timer.reset
		sleep(0.5)
		puts "slept for 0.5 seconds"
		timer.reset
		sleep(0.5)
		puts "slept for 0.5 seconds"
		timer.reset
		sleep(0.5)
		puts "Slept for 0.5 seconds, 2 total, will now timeout."
		sleep(100)
	}
rescue Timeout::Error
	puts "Timed out"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rolling_timeout-0.0.1 examples/example.rb