holdon 0.1.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/holdon.rb +23 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjFkY2RmYmZhODQ5NDVhNDk1ZGEzZWZlN2NmZjM5ZTI1NmMxNjIyZQ==
4
+ NTA2MTYzMzY3ZGZiZjgzODgzMDlkYzZkYzQ1NmU2ODA1N2NiOWQ1NA==
5
5
  data.tar.gz: !binary |-
6
- MTRmNzRjYzIyMjBlMzM4N2RmOTE4NDNhMWM1NDdkNjUyMWIxMWExZQ==
6
+ YzQyN2MwZDE0ZDQ0ODM5MmM3OWE4ZTJlYzAwYjM0Zjk1ZjQ1ZTc2Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OGUxOGU4M2M1MmNhZDEzNDc4OTJhYWJhYzgyNmRjZjBkYjUzMDlkYTI4ZDA3
10
- ZGRhMGEwOWJlODYwZTNkZjA5NjkzYmQyNzM0NTQ2ZGU2MWNhOTU4ZWU0NzE0
11
- ZTJlMTlhYmEyZDhjNGVhOTZhOTQ4YmYzOWVkZDJmNmY4ODQwNDY=
9
+ OWNkZmQ1Y2Q3ZjYxNDNiMWUxMDFlNjQ2MzcxMDMzMzAxOTEwNGVhMTU1MTM3
10
+ YmY2YzQ0OTgxYmU5NDZlNjM0NWIyNWQ1MTkyZmI2NTRjODFhMmYxZTk4ODBh
11
+ MjkxZTFhODA3YzAyY2ZmMzdjN2MxMGZiODU5ODRkYmMzNDA0MmM=
12
12
  data.tar.gz: !binary |-
13
- NGUzYjg0OTBjNTRjMmMyNmVkZTI2YmI3ZWE3Nzg3NzNjZTM0YzNmM2VhZDlm
14
- NTk5OTBmZWFjZjllNGQ2MTZkOGY5YzYzYzVlZTk5OTQ0Y2UwODIxOGExY2Qy
15
- MTMwNjQxYjA5OGQ2MTUwZmI0YzBjNjM2NmQ0Y2I4NjAyYjljMjA=
13
+ ZDI4MWIyMjAxMjdjZGY1OWQwMThlNDhjYjU5YjM3OTg2Y2ZiZGI3YzRlMjQy
14
+ MTA3MWI1YjNhMjEyYTc1NjRkOTdiOWIwMjBhMGU1ZmM1YjgyMjI4NWJlY2Rl
15
+ NTU3MDMwZGMzYjJiNGM1NWUwYzM0MDY2NTBlYzdiOWVjYmY3NTE=
@@ -1,7 +1,7 @@
1
1
 
2
2
  module HoldOn
3
3
 
4
- class Timeout < Exception
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holdon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lauber