Class: Textus::Step::OrientationTransform

Inherits:
Transform show all
Defined in:
lib/textus/init/templates/orientation_reducer.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Transform

required_kwargs

Methods inherited from Base

kind, required_kwargs, step_name

Instance Method Details

#call(rows:, config:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/textus/init/templates/orientation_reducer.rb', line 7

def call(rows:, config:, **)
  project_row = rows.find { |r| r["_key"] == "knowledge.project" } || {}
  runbook_rows = rows.select { |r| r["_key"]&.start_with?("knowledge.runbooks.") }

  {
    "project" => {
      "name" => project_row["name"],
      "description" => project_row["description"]
    },
    "runbooks" => runbook_rows.map { |r| { "name" => r["name"], "description" => r["description"] } }
  }
end