Class: Tasker::WorkflowStep::StepFinder

Inherits:
Object
  • Object
show all
Defined in:
app/models/tasker/workflow_step.rb

Overview

Service class to find steps by name Reduces complexity by organizing step search logic

Class Method Summary collapse

Class Method Details

.find_by_name(steps, name) ⇒ WorkflowStep?

Find step by name in provided collection or task hierarchy

Parameters:

  • steps (Array<WorkflowStep>)

    Collection of steps to search through

  • name (String)

    Name of the step to find

Returns:

  • (WorkflowStep, nil)

    The first matching step found or nil if none exists



208
209
210
211
212
213
214
215
216
217
# File 'app/models/tasker/workflow_step.rb', line 208

def find_by_name(steps, name)
  return nil if steps.empty? || name.nil?

  # First check direct match in provided steps
  direct_match = find_direct_match(steps, name)
  return direct_match if direct_match

  # Fall back to task-wide search using DAG relationships
  find_in_task_hierarchy(steps, name)
end