holdon 0.1.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/holdon.rb +23 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTA2MTYzMzY3ZGZiZjgzODgzMDlkYzZkYzQ1NmU2ODA1N2NiOWQ1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzQyN2MwZDE0ZDQ0ODM5MmM3OWE4ZTJlYzAwYjM0Zjk1ZjQ1ZTc2Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWNkZmQ1Y2Q3ZjYxNDNiMWUxMDFlNjQ2MzcxMDMzMzAxOTEwNGVhMTU1MTM3
|
10
|
+
YmY2YzQ0OTgxYmU5NDZlNjM0NWIyNWQ1MTkyZmI2NTRjODFhMmYxZTk4ODBh
|
11
|
+
MjkxZTFhODA3YzAyY2ZmMzdjN2MxMGZiODU5ODRkYmMzNDA0MmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDI4MWIyMjAxMjdjZGY1OWQwMThlNDhjYjU5YjM3OTg2Y2ZiZGI3YzRlMjQy
|
14
|
+
MTA3MWI1YjNhMjEyYTc1NjRkOTdiOWIwMjBhMGU1ZmM1YjgyMjI4NWJlY2Rl
|
15
|
+
NTU3MDMwZGMzYjJiNGM1NWUwYzM0MDY2NTBlYzdiOWVjYmY3NTE=
|
data/lib/holdon.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module HoldOn
|
3
3
|
|
4
|
-
class Timeout <
|
4
|
+
class Timeout < StandardError
|
5
5
|
end
|
6
6
|
|
7
7
|
|
@@ -21,6 +21,28 @@ module HoldOn
|
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
|
+
# This method just introduces a delay into the code that
|
25
|
+
# can be exited prematurely. Useful when you are waiting
|
26
|
+
# for something that *might* happen.
|
27
|
+
def self.delay_until(options = {}, &block)
|
28
|
+
begin
|
29
|
+
self.until(options, &block)
|
30
|
+
rescue HoldOn::Timeout
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# This method just introduces a delay into the code that
|
36
|
+
# can be exited prematurely. Useful when you are waiting
|
37
|
+
# for something that *might* happen.
|
38
|
+
def self.delay_while(options = {}, &block)
|
39
|
+
begin
|
40
|
+
self.while(options, &block)
|
41
|
+
rescue HoldOn::Timeout
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
24
46
|
def self.breaker(options = {})
|
25
47
|
timeout = options.fetch(:timeout, 30)
|
26
48
|
interval = options.fetch(:interval, 1)
|