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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1361dd8d8fafb99718c6891dc52ec337871557417c924599dbb06eba31bf98bf
4
- data.tar.gz: 863a6748e6af4b6d1e79eb73c7e2fb91305a020694262824080de059a4f3b761
3
+ metadata.gz: 9654a5bc79a6a1babe30e7605bc6e95552c7452b70547c1730a5974ec72da873
4
+ data.tar.gz: f6504a1f1a970c4946b7d50759d74fb3700cebfbe6f369514e9b757e0704700d
5
5
  SHA512:
6
- metadata.gz: e4c7aba95f41c4da1d44c6f395b7c7c849d0162796b43a7a98aa99550edde255f4f0f09e5d22a1230886c2adf63c54deed36e5987a2d2c3776a6bc9624d310b7
7
- data.tar.gz: 30a459f1b57bb2dd135bd7417df2775364375f76c5065b91722e23b2c2a94906d0dd3605412aa685b75825b847338860d63016ef1c0a0136e7bd5382b072228a
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*
@@ -10,7 +10,7 @@ module Core
10
10
  @error = nil
11
11
  end
12
12
 
13
- # [public] Wait on the task to complete, returning self.
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?
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module Async
5
- VERSION = "0.2.1"
5
+ VERSION = "0.3.0"
6
6
 
7
7
  def self.version
8
8
  VERSION
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.2.1
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-06 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async