class Nocode::Steps::Each

Iterate over a register. Each iteration will store the current element and index in special registers called: _element and _index. You can prefix these registers by setting the element_register_prefix option.

Public Instance Methods

perform() click to toggle source
# File lib/nocode/steps/each.rb, line 15
def perform
  entries.each_with_index do |entry, index|
    registers[element_key] = entry
    registers[index_key]   = index

    execute_steps
  end
end

Private Instance Methods

element_key() click to toggle source
# File lib/nocode/steps/each.rb, line 38
def element_key
  "#{element_register_prefix_option}_element"
end
entries() click to toggle source
# File lib/nocode/steps/each.rb, line 30
def entries
  array(registers[register_option])
end
execute_steps() click to toggle source
# File lib/nocode/steps/each.rb, line 26
def execute_steps
  StepsExecutor.new(context: context, steps: steps).execute
end
index_key() click to toggle source
# File lib/nocode/steps/each.rb, line 42
def index_key
  "#{element_register_prefix_option}_index"
end
steps() click to toggle source
# File lib/nocode/steps/each.rb, line 34
def steps
  array(steps_option)
end