timeout 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timeout.rb +5 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd4f136237f88c0a2be5a602882f7cdddc0f5ea1429de76f931cb2ec9718a93c
|
4
|
+
data.tar.gz: d86f8c2744f1ac20722c3d9def4979c1452b4548291cd8a287f89216199f1c7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38d56618f21b6b4a5b75cf0e40ec66341aba9dab49ff948becee93a8ca1985e759208b7a4408511914d21f818ba1c37dae2fa2b6af48f43d72e1fc555eddf9b4
|
7
|
+
data.tar.gz: acdbb666b3d85f2ca400e583d29f282e1e1568b7fa0f334ea502ad18f17ff99e64bc6b3cf4eb111a283be9b1e88bea1068a249aa6caf5d8bcbc64d745ba7f2e9
|
data/lib/timeout.rb
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
|
21
21
|
module Timeout
|
22
22
|
# The version
|
23
|
-
VERSION = "0.4.
|
23
|
+
VERSION = "0.4.3"
|
24
24
|
|
25
25
|
# Internal error raised to when a timeout is triggered.
|
26
26
|
class ExitException < Exception
|
@@ -141,9 +141,10 @@ module Timeout
|
|
141
141
|
# Perform an operation in a block, raising an error if it takes longer than
|
142
142
|
# +sec+ seconds to complete.
|
143
143
|
#
|
144
|
-
# +sec+:: Number of seconds to wait for the block to terminate. Any number
|
145
|
-
# may be used, including Floats to specify fractional seconds. A
|
144
|
+
# +sec+:: Number of seconds to wait for the block to terminate. Any non-negative number
|
145
|
+
# or nil may be used, including Floats to specify fractional seconds. A
|
146
146
|
# value of 0 or +nil+ will execute the block without any timeout.
|
147
|
+
# Any negative number will raise an ArgumentError.
|
147
148
|
# +klass+:: Exception Class to raise if the block fails to terminate
|
148
149
|
# in +sec+ seconds. Omitting will use the default, Timeout::Error
|
149
150
|
# +message+:: Error message to raise with Exception Class.
|
@@ -165,6 +166,7 @@ module Timeout
|
|
165
166
|
# a module method, so you can call it directly as Timeout.timeout().
|
166
167
|
def timeout(sec, klass = nil, message = nil, &block) #:yield: +sec+
|
167
168
|
return yield(sec) if sec == nil or sec.zero?
|
169
|
+
raise ArgumentError, "Timeout sec must be a non-negative number" if 0 > sec
|
168
170
|
|
169
171
|
message ||= "execution expired"
|
170
172
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Auto-terminate potentially long-running operations in Ruby.
|
14
14
|
email:
|
@@ -32,7 +32,7 @@ metadata:
|
|
32
32
|
homepage_uri: https://github.com/ruby/timeout
|
33
33
|
source_code_uri: https://github.com/ruby/timeout
|
34
34
|
changelog_uri: https://github.com/ruby/timeout/releases
|
35
|
-
post_install_message:
|
35
|
+
post_install_message:
|
36
36
|
rdoc_options: []
|
37
37
|
require_paths:
|
38
38
|
- lib
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
50
|
rubygems_version: 3.5.11
|
51
|
-
signing_key:
|
51
|
+
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: Auto-terminate potentially long-running operations in Ruby.
|
54
54
|
test_files: []
|