attr-gather 1.1.2 → 1.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f0cfb5dd834161d41a92270f036981babbc4c64a7a2a0be6c223b52e68f22ed
4
- data.tar.gz: e865667f933a51c3931e5c04d09d27bb30effabaae7aa247197f5b23e36908c6
3
+ metadata.gz: 07ef681505341f374e4374d1baf4b5a8630a34b5dc87dc4fcaec159b2a7efeb2
4
+ data.tar.gz: 680bc4891c2a140b6af5e780d97dba80e7ceb5aa750f8a0fe88dffcf7327c9f5
5
5
  SHA512:
6
- metadata.gz: 4feb0be067955ac28cc1da31cf278a717a9aa56f43e97409fb110f822acacbae0fda1fc5bc2529c19a0e1d453bd87ef5a140ecde1494da5e5708c8ef4c47b7d4
7
- data.tar.gz: 343523a4a84ec2326f9487051898ac3bce17e504a7bda5b93e4e03092bbd5aff4ae3a49b8cde9d2dfa24760803a783ff04d1b4fcc22f28954a798ab35d4503eb
6
+ metadata.gz: 4a634990d091aff5b530c06341e2cb2fdbad34cbec9f4b4dee073245822f45633fab79cbb8c4b76ee95dcda62d56a5b1ec856ac4b7500d04f9478a548664e070
7
+ data.tar.gz: 6c1dddb4c8478d28ced0677c2b1b4b86343404f645721dde7af77ed9cdc44e880f1ece2fd3a271b26ed85b2325b7b8d4c5ce6cffaa5e1e9b4c2b589c0430dfb7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attr-gather (1.1.2)
4
+ attr-gather (1.1.3)
5
5
  dry-container (~> 0.7)
6
6
 
7
7
  GEM
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Attr
4
4
  module Gather
5
- VERSION = '1.1.2'
5
+ VERSION = '1.1.3'
6
6
  end
7
7
  end
@@ -20,11 +20,11 @@ module Attr
20
20
 
21
21
  attr_reader :task, :result, :started_at, :uuid
22
22
 
23
- def initialize(task, result)
24
- @started_at = Time.now
25
- @uuid = SecureRandom.uuid
23
+ def initialize(task, result, started_at: Time.now, uuid: SecureRandom.uuid) # rubocop:disable Metrics/LineLength
26
24
  @task = task
27
25
  @result = result
26
+ @started_at = started_at
27
+ @uuid = uuid
28
28
  end
29
29
 
30
30
  # @!attribute [r] state
@@ -41,6 +41,25 @@ module Attr
41
41
  result.value!
42
42
  end
43
43
 
44
+ # Chain a new block result to be executed after resolution
45
+ #
46
+ # @return [TaskExecutionResult] the new task execution result
47
+ # @yield The block operation to be performed asynchronously.
48
+ def then(*args, &block)
49
+ new_result = result.then(*args, &block)
50
+ self.class.new(task, new_result, started_at: @started_at, uuid: @uuid)
51
+ end
52
+
53
+ # Catch an async exception when a failure occurs
54
+ #
55
+ # @return [TaskExecutionResult] the new task execution result
56
+ # @yield The block operation to be performed asynchronously.
57
+ def catch(*args, &block)
58
+ new_result = result.catch(*args, &block)
59
+ self.class.new(task, new_result, started_at: @started_at, uuid: @uuid)
60
+ end
61
+
62
+ # Executes a block after the result is fulfilled
44
63
  # Represents the TaskExecutionResult as a hash
45
64
  #
46
65
  # @return [Hash]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr-gather
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler