action_operation 2.1.1 → 2.1.2

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: 29ca21fd117c2555cea1ce9f8bef22eb17ee0e0d6d0b72b971fb0bd218dd5f3e
4
- data.tar.gz: 4c5f1e3f02005956b4664d92c738c956cbc1267193ce2b863cb5d2b54f814450
3
+ metadata.gz: a846d65438bef6ffc0ab9fc92d244eddbedd899fc55e93047b87753e3fb4b8cc
4
+ data.tar.gz: ecadc2048e631a532ef3e44a0b777f936de0801f578ab067958de662b793533f
5
5
  SHA512:
6
- metadata.gz: e8e45d6ac5994b21d95c7f9b81129645b8f5b8ed82f827ca7cb0b1be64ee392ec5e2be795dfa8eb5ee1132fa69c0344bbe0c8b65158a4d6e0507ec430f85f317
7
- data.tar.gz: e51b24022609d66ea3b5d08350181f5c38525f63b6c8cc689ca46898125bb2918c5a25d1cd469f97571461bc54bdd232eddc3d1a24b014850e4bf6efb300b7da
6
+ metadata.gz: e8299c5b881d42659982fd058c5dc0fabede4a262eee74380a09fa35677a6fdc5b3aad9b7fea7ecfa13257d891cf7167b4d018ceb9c7afaa501b23ea41c22355
7
+ data.tar.gz: ee88c4f8d8ded7e7be2b6fd745786b9bfb01301422ef8566c1b9fa7bc125f6ea574364edd25456ae18b4fa29c958c1a9e2b01344928c10d58e24f6c3d00d7f9f
data/README.md CHANGED
@@ -258,7 +258,7 @@ While `around_steps` is on the entire operation, you might want individual wrapp
258
258
 
259
259
  ``` ruby
260
260
  class AddProductToCart < ApplicationOperation
261
- def around_step(step:)
261
+ def around_step(step:, **)
262
262
  Rails.logger.tagged("step-id=#{SecureRandom.uuid}") do
263
263
  yield
264
264
  end
@@ -273,13 +273,13 @@ Finally, there are 4 other type specific hooks: `around_tasks`, `around_task`, `
273
273
 
274
274
  ``` ruby
275
275
  class AddProductToCart < ApplicationOperation
276
- def around_tasks
276
+ def around_tasks(**)
277
277
  Timeout.new(30.seconds) do
278
278
  yield
279
279
  end
280
280
  end
281
281
 
282
- def around_task(step:, state:)
282
+ def around_task(step:, state:, **)
283
283
  Rails.logger.debug("Working on #{step.receiver}##{step.name} using (#{state.to_json})")
284
284
 
285
285
  Timeout.new(10.seconds) do
@@ -296,7 +296,7 @@ end
296
296
 
297
297
  Add this line to your application's Gemfile:
298
298
 
299
- gem "action_operation", "2.1.1"
299
+ gem "action_operation", "2.1.2"
300
300
 
301
301
  And then execute:
302
302
 
@@ -47,8 +47,10 @@ module ActionOperation
47
47
  # puts "#{step.class}::#{step.receiver}##{step.name}"
48
48
 
49
49
  begin
50
- value = around_task(state: self.class.schemas.fetch(step.name).new(state), raw: raw, step: step) do
51
- public_send(step.name, state: self.class.schemas.fetch(step.name).new(state))
50
+ value = around_step(state: self.class.schemas.fetch(step.name).new(state), raw: raw, step: step) do
51
+ around_task(state: self.class.schemas.fetch(step.name).new(state), raw: raw, step: step) do
52
+ public_send(step.name, state: self.class.schemas.fetch(step.name).new(state))
53
+ end
52
54
  end
53
55
  # puts "#{step.class}::#{step.receiver}##{step.name} #{value}"
54
56
  rescue SmartParams::Error::InvalidPropertyType => invalid_property_type_exception
@@ -72,8 +74,10 @@ module ActionOperation
72
74
  # puts "#{step.class}::#{step.receiver}##{step.name}"
73
75
 
74
76
  begin
75
- value = around_catch(exception: exception, raw: raw, step: step) do
76
- public_send(step.name, exception: exception, state: raw, step: @latest_step)
77
+ value = around_step(exception: exception, raw: raw, step: step) do
78
+ around_catch(exception: exception, raw: raw, step: step) do
79
+ public_send(step.name, exception: exception, state: raw, step: @latest_step)
80
+ end
77
81
  end
78
82
  # puts "#{step.class}::#{step.receiver}##{step.name} #{value}"
79
83
  rescue SmartParams::Error::InvalidPropertyType => invalid_property_type_exception
@@ -100,28 +104,28 @@ module ActionOperation
100
104
  Drift.new(to)
101
105
  end
102
106
 
103
- def around_steps(&callback)
104
- callback.call
107
+ def around_steps(raw:, &callback)
108
+ callback.call(raw: raw)
105
109
  end
106
110
 
107
- def around_step(&callback)
108
- callback.call
111
+ def around_step(state: nil, exception: nil, raw:, step:, &callback)
112
+ callback.call(state: state, exception: exception, raw: raw, step: step)
109
113
  end
110
114
 
111
- def around_tasks(&callback)
112
- callback.call
115
+ def around_tasks(raw:, &callback)
116
+ callback.call(raw: raw)
113
117
  end
114
118
 
115
- def around_task(&callback)
116
- callback.call
119
+ def around_task(state:, raw:, step:, &callback)
120
+ callback.call(state: state, raw: raw, step: step)
117
121
  end
118
122
 
119
- def around_catches(&callback)
120
- callback.call
123
+ def around_catches(exception:, raw:, &callback)
124
+ callback.call(exception: exception, raw: raw)
121
125
  end
122
126
 
123
- def around_catch(&callback)
124
- callback.call
127
+ def around_catch(exception:, raw:, step:, &callback)
128
+ callback.call(exception: exception, raw: raw, step: step)
125
129
  end
126
130
 
127
131
  private def left
@@ -1,3 +1,3 @@
1
1
  module ActionOperation
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_operation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurtis Rainbolt-Greene