class ArrayTransform::Operations::UpdateRow

Attributes

cell_operation[R]
data[R]
row_offset[R]

Public Class Methods

new( cell_operation:, data:, row_offset: 0 ) click to toggle source
# File lib/array_transform/operations/update_row.rb, line 6
def initialize(
  cell_operation:,
  data:,
  row_offset: 0
)
  @cell_operation = cell_operation
  @data = data
  @row_offset = row_offset
end

Public Instance Methods

call() click to toggle source
# File lib/array_transform/operations/update_row.rb, line 18
def call
  modify_row
end

Private Instance Methods

modify_row() click to toggle source
# File lib/array_transform/operations/update_row.rb, line 26
def modify_row
  data[row_offset] && data[row_offset].each_with_index do |value, index|
    data[row_offset][index] = cell_operation.call(value)
  end
end