core-async 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/core/async/future.rb +21 -1
- data/lib/core/async/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9654a5bc79a6a1babe30e7605bc6e95552c7452b70547c1730a5974ec72da873
|
4
|
+
data.tar.gz: f6504a1f1a970c4946b7d50759d74fb3700cebfbe6f369514e9b757e0704700d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06294b7f7f8318ddfeffae3e8570db862df6bef50380538b8eaffa65d1f0b1652b5de51658d76cdd7db712cf39336c6265d8b9f60967ffa3f667d5ed380e953c'
|
7
|
+
data.tar.gz: 3772a550147e500c238863eb4ea9ed0b6175c1e18a1b4b6b5f81e29f43831258d2fad3cb107111377036f7e58e5fa62f16319cde4cda015a1490a44ed40a0e4c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## [v0.3.0](https://github.com/metabahn/corerb/releases/tag/2021-03-17)
|
2
|
+
|
3
|
+
*released on 2021-03-17*
|
4
|
+
|
5
|
+
* `add` [#20](https://github.com/metabahn/corerb/pull/20) Allow futures to be canceled ([bryanp](https://github.com/bryanp))
|
6
|
+
|
1
7
|
## [v0.2.1](https://github.com/metabahn/corerb/releases/tag/2021-03-05)
|
2
8
|
|
3
9
|
*released on 2021-03-05*
|
data/lib/core/async/future.rb
CHANGED
@@ -10,7 +10,7 @@ module Core
|
|
10
10
|
@error = nil
|
11
11
|
end
|
12
12
|
|
13
|
-
# [public] Wait on the
|
13
|
+
# [public] Wait on the future to resolve, returning self.
|
14
14
|
#
|
15
15
|
def wait
|
16
16
|
unless @error
|
@@ -20,6 +20,18 @@ module Core
|
|
20
20
|
self
|
21
21
|
end
|
22
22
|
|
23
|
+
# [public] Attempt to cancel the future, returns true if successful.
|
24
|
+
#
|
25
|
+
def cancel
|
26
|
+
if pending?
|
27
|
+
@task.stop
|
28
|
+
wait
|
29
|
+
true
|
30
|
+
else
|
31
|
+
false
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
23
35
|
# [public] Return the result, blocking until available.
|
24
36
|
#
|
25
37
|
def result
|
@@ -68,6 +80,8 @@ module Core
|
|
68
80
|
case @task.status
|
69
81
|
when :running
|
70
82
|
:pending
|
83
|
+
when :stopped
|
84
|
+
:canceled
|
71
85
|
when :failed
|
72
86
|
:failed
|
73
87
|
when :complete
|
@@ -91,6 +105,12 @@ module Core
|
|
91
105
|
status == :failed
|
92
106
|
end
|
93
107
|
|
108
|
+
# [public] Return `true` if canceled.
|
109
|
+
#
|
110
|
+
def canceled?
|
111
|
+
status == :canceled
|
112
|
+
end
|
113
|
+
|
94
114
|
# [public] Return `true` if complete.
|
95
115
|
#
|
96
116
|
def complete?
|
data/lib/core/async/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|