Class: Grumlin::ShortcutsApplyer

Inherits:
Object
  • Object
show all
Defined in:
lib/grumlin/shortcuts_applyer.rb

Class Method Summary collapse

Class Method Details

.call(steps) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/grumlin/shortcuts_applyer.rb', line 5

def call(steps)
  return steps if !steps.is_a?(Grumlin::Steps) || !steps.uses_shortcuts?

  shortcuts = steps.shortcuts

  steps = [
    *process_steps(steps.configuration_steps, shortcuts),
    *process_steps(steps.steps, shortcuts)
  ]

  Grumlin::Steps.new(shortcuts).tap do |processed_steps|
    steps.each do |step|
      processed_steps.add(step.name, args: step.args, params: step.params)
    end
  end
end