Module: ActionOperation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/action_operation.rb,
lib/action_operation/error.rb,
lib/action_operation/types.rb,
lib/action_operation/version.rb,
lib/action_operation/error/missing_task.rb,
lib/action_operation/error/missing_error.rb,
lib/action_operation/error/missing_schema.rb,
lib/action_operation/error/step_schema_mismatch.rb
Defined Under Namespace
Modules: Types
Classes: Catch, Drift, Error, State, Task
Constant Summary
collapse
- VERSION =
"2.1.1"
Instance Method Summary
collapse
Instance Method Details
#around_catch(&callback) ⇒ Object
123
124
125
|
# File 'lib/action_operation.rb', line 123
def around_catch(&callback)
callback.call
end
|
#around_catches(&callback) ⇒ Object
119
120
121
|
# File 'lib/action_operation.rb', line 119
def around_catches(&callback)
callback.call
end
|
#around_step(&callback) ⇒ Object
107
108
109
|
# File 'lib/action_operation.rb', line 107
def around_step(&callback)
callback.call
end
|
#around_steps(&callback) ⇒ Object
103
104
105
|
# File 'lib/action_operation.rb', line 103
def around_steps(&callback)
callback.call
end
|
#around_task(&callback) ⇒ Object
115
116
117
|
# File 'lib/action_operation.rb', line 115
def around_task(&callback)
callback.call
end
|
#around_tasks(&callback) ⇒ Object
111
112
113
|
# File 'lib/action_operation.rb', line 111
def around_tasks(&callback)
callback.call
end
|
#call(start: nil, raw: @raw) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/action_operation.rb', line 23
def call(start: nil, raw: @raw)
around_steps(raw: raw) do
begin
around_tasks(raw: raw) do
tasks(start, raw)
end
rescue *left.select(&:exception).map(&:exception).uniq => handled_exception
around_catches(exception: handled_exception, raw: raw) do
catches(handled_exception, raw)
end
end
end
end
|
#drift(to:) ⇒ Object
97
98
99
100
101
|
# File 'lib/action_operation.rb', line 97
def drift(to:)
raise ArgumentError, "needs to be a Symbol or String" unless to.kind_of?(Symbol) || to.kind_of?(String)
Drift.new(to)
end
|
#fresh(state:) ⇒ Object
91
92
93
94
95
|
# File 'lib/action_operation.rb', line 91
def fresh(state:)
raise ArgumentError, "needs to be a Hash" unless state.kind_of?(Hash)
State.new(state)
end
|
#initialize(raw:) ⇒ Object
17
18
19
20
21
|
# File 'lib/action_operation.rb', line 17
def initialize(raw:)
raise ArgumentError, "needs to be a Hash" unless raw.kind_of?(Hash)
@raw = raw
end
|
#reraise(exception:) ⇒ Object
135
136
137
|
# File 'lib/action_operation.rb', line 135
def reraise(exception:, **)
raise exception
end
|