class Nocode::Steps::Dataset::Range

Slice a dataset and keep on the entries between start_index and end_index, inclusively. If start_index is not provided then it defaults to 0. If end_index is not provided then it defaults to the end of the dataset.

Public Instance Methods

perform() click to toggle source
# File lib/nocode/steps/dataset/range.rb, line 14
def perform
  registers[register_option] = array(registers[register_option])

  registers[register_option] = registers[register_option][start_index..end_index]
end

Private Instance Methods

end_index() click to toggle source
# File lib/nocode/steps/dataset/range.rb, line 26
def end_index
  end_index_option.nil? ? -1 : end_index_option.to_i
end
start_index() click to toggle source
# File lib/nocode/steps/dataset/range.rb, line 22
def start_index
  start_index_option.nil? ? 0 : start_index_option.to_i
end