[ruby/timeout] removed the non numeric check
https://github.com/ruby/timeout/commit/7d2af46a00 Co-authored-by: Jeremy Evans <code@jeremyevans.net>
This commit is contained in:
parent
7dc7aab4e9
commit
f6b62d001a
@ -165,8 +165,8 @@ module Timeout
|
|||||||
# Timeout</tt> into your classes so they have a #timeout method, as well as
|
# Timeout</tt> into your classes so they have a #timeout method, as well as
|
||||||
# a module method, so you can call it directly as Timeout.timeout().
|
# a module method, so you can call it directly as Timeout.timeout().
|
||||||
def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+
|
def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+
|
||||||
raise ArgumentError, "Timeout sec must be a non-negative number" if sec && !(sec.is_a?(Numeric) && sec >= 0)
|
|
||||||
return yield(sec) if sec == nil or sec.zero?
|
return yield(sec) if sec == nil or sec.zero?
|
||||||
|
raise ArgumentError, "Timeout sec must be a non-negative number" if 0 > sec
|
||||||
|
|
||||||
message ||= "execution expired"
|
message ||= "execution expired"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user