0.02
Low commit activity in last 3 years
A long-lived project that still receives updates
A safer alternative to Ruby's Timeout that uses unix processes instead of threads.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

 Project Readme

SafeTimeout

Status

Gem Version Build Status Code Climate Test Coverage MIT License

Description

A safer alternative to Ruby's Timeout that uses unix processes instead of threads

Installation

Add this line to your application's Gemfile:

gem 'safe_timeout'

And then execute:

$ bundle

Or install it yourself as:

$ gem install safe_timeout

Usage

SafeTimeout is a drop-in replacement for Ruby's Timeout.

SafeTimeout.timeout(2) do
  # Something that may take a while
  # Possible Timeout::Error raised
end

or

SafeTimeout.timeout(10, CustomTimeoutError) do
  # Something that may take a while
  # Possible CustomTimeoutError raised
end

If one wishes this to be even more of a drop-in replacement one could add the following to the top of an application:

Timeout = SafeTimeout

License

MIT. See the {file:LICENSE} file.