rsmp 0.8.6 → 0.9.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.
File without changes
data/lib/rsmp/wait.rb DELETED
@@ -1,16 +0,0 @@
1
- module RSMP
2
- module Wait
3
- # wait for an async condition to signal, then yield to block
4
- # if block returns true we're done. otherwise, wait again
5
- def wait_for condition, timeout, &block
6
- raise RuntimeError.new("Can't wait for condition because task is not running") unless @task.running?
7
- @task.with_timeout(timeout) do
8
- while @task.running? do
9
- value = condition.wait
10
- result = yield value
11
- return result if result # return result of check, if not nil
12
- end
13
- end
14
- end
15
- end
16
- end
data/test.rb DELETED
@@ -1,27 +0,0 @@
1
- class A
2
- def go &block
3
- @block = block # block will be converted automatically to a Proc
4
- indirect
5
- end
6
-
7
- def call
8
- @block.call
9
- end
10
-
11
- def indirect
12
- call
13
- end
14
-
15
- end
16
-
17
- a = A.new
18
-
19
- a.go do
20
- break # this is ok. break causes the block to exit, and the encasing method to return - go() will exit
21
- end
22
-
23
- # this raises an error. the block we passed to go() will be called again, and it tries to break
24
- # but we're not inside a method we can exit from
25
-
26
-
27
- a.indirect