Class: Ace::Task::Molecules::TaskReparenter
- Inherits:
-
Object
- Object
- Ace::Task::Molecules::TaskReparenter
- Defined in:
- lib/ace/task/molecules/task_reparenter.rb
Overview
Reparents tasks: promote subtask to standalone, convert to orchestrator, or demote standalone to subtask of another task.
Instance Method Summary collapse
-
#initialize(root_dir:, config: {}) ⇒ TaskReparenter
constructor
A new instance of TaskReparenter.
-
#reparent(task, target:, resolve_ref:) ⇒ Models::Task
Reparent a task based on the target value.
Constructor Details
#initialize(root_dir:, config: {}) ⇒ TaskReparenter
Returns a new instance of TaskReparenter.
16 17 18 19 |
# File 'lib/ace/task/molecules/task_reparenter.rb', line 16 def initialize(root_dir:, config: {}) @root_dir = root_dir @config = config end |
Instance Method Details
#reparent(task, target:, resolve_ref:) ⇒ Models::Task
Reparent a task based on the target value.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ace/task/molecules/task_reparenter.rb', line 27 def reparent(task, target:, resolve_ref:) case target.downcase when "none" promote_to_standalone(task) when "self" convert_to_orchestrator(task) else demote_to_subtask(task, parent_ref: target, resolve_ref: resolve_ref) end end |