Module: TestWorkflow
- Defined in:
- lib/test_workflow.rb,
lib/test_workflow/version.rb
Defined Under Namespace
Modules: Paths
Constant Summary collapse
- VERSION =
"0.1.0".freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#continue_path_to(context, keys = { using: :default }, &block) ⇒ Object
Provides an execution path that starts execution of a given path from the standpoint of the “current context”, which is something that must be set as part of execution logic.
-
#entire_path(keys = { using: :default, visit: false }) ⇒ Object
(also: #run_entire_path, #run_full_path)
Provides an execution path for an entire workflow path.
-
#path_to(context, keys = { using: :default, visit: false }, &block) ⇒ Object
(also: #path_up_to, #workflow_to, #workflow_up_to)
Provides an execution path for a given workflow path, using a specific definition that is part of that workflow path.
Class Method Details
.caller ⇒ Object
23 24 25 |
# File 'lib/test_workflow.rb', line 23 def self.caller @caller end |
.included(caller) ⇒ Object
18 19 20 21 |
# File 'lib/test_workflow.rb', line 18 def self.included(caller) caller.extend Paths @caller = caller end |
Instance Method Details
#continue_path_to(context, keys = { using: :default }, &block) ⇒ Object
Provides an execution path that starts execution of a given path from the standpoint of the “current context”, which is something that must be set as part of execution logic.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/test_workflow.rb', line 50 def continue_path_to(context, keys = { using: :default }, &block) path = workflow_path_for(keys) path_start = find_index_for(path, @current_context.class) path_end = find_index_for(path, context) - 1 if path_start == path_end execute_path([path[path_start]], false) else execute_path(path[path_start..path_end], false) end on(context, &block) end |
#entire_path(keys = { using: :default, visit: false }) ⇒ Object Also known as: run_entire_path, run_full_path
Provides an execution path for an entire workflow path.
65 66 67 68 |
# File 'lib/test_workflow.rb', line 65 def entire_path(keys = { using: :default, visit: false }) path_workflow = workflow_path_for(keys) execute_path(path_workflow[0..-1], keys[:visit]) end |
#path_to(context, keys = { using: :default, visit: false }, &block) ⇒ Object Also known as: path_up_to, workflow_to, workflow_up_to
Provides an execution path for a given workflow path, using a specific definition that is part of that workflow path.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/test_workflow.rb', line 29 def path_to(context, keys = { using: :default, visit: false }, &block) keys[:using] = :default unless keys[:using] keys[:visit] = false unless keys[:visit] path, path_goal = path_trail(keys, context) return on(context, &block) if path_goal == -1 path_start = keys[:from] ? path_start_point(path, keys) : 0 execute_path(path[path_start..path_goal], keys[:visit]) on(context, &block) end |