[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:
Cosmic Oppai 2024-11-19 01:56:21 +05:30 committed by git
parent 7dc7aab4e9
commit f6b62d001a

View File

@ -165,8 +165,8 @@ module Timeout
# 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().
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?
raise ArgumentError, "Timeout sec must be a non-negative number" if 0 > sec
message ||= "execution expired"