class Nocode::Steps::Map
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.
The main difference between this and ‘each’ is that this will collect the iterator element register and set the register to this new collection.
Public Instance Methods
perform()
click to toggle source
# File lib/nocode/steps/map.rb, line 18 def perform registers[register_option] = entries.map.with_index do |entry, index| registers[element_key] = entry registers[index_key] = index execute_steps registers[element_key] end end
Private Instance Methods
element_key()
click to toggle source
# File lib/nocode/steps/map.rb, line 43 def element_key "#{element_register_prefix_option}_element" end
entries()
click to toggle source
# File lib/nocode/steps/map.rb, line 35 def entries array(registers[register_option]) end
execute_steps()
click to toggle source
# File lib/nocode/steps/map.rb, line 31 def execute_steps StepsExecutor.new(context: context, steps: steps).execute end
index_key()
click to toggle source
# File lib/nocode/steps/map.rb, line 47 def index_key "#{element_register_prefix_option}_index" end
steps()
click to toggle source
# File lib/nocode/steps/map.rb, line 39 def steps array(steps_option) end