Class: ArrayTransform::Operations::AddIndexColumn
- Inherits:
-
Object
- Object
- ArrayTransform::Operations::AddIndexColumn
- Includes:
- Callable
- Defined in:
- lib/array_transform/operations/add_index_column.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(new_column_header: nil, data:, index_offset: 0) ⇒ AddIndexColumn
constructor
A new instance of AddIndexColumn.
Methods included from Callable
Constructor Details
#initialize(new_column_header: nil, data:, index_offset: 0) ⇒ AddIndexColumn
Returns a new instance of AddIndexColumn.
6 7 8 9 10 11 12 13 14 |
# File 'lib/array_transform/operations/add_index_column.rb', line 6 def initialize( new_column_header: nil, data:, index_offset: 0 ) @new_column_header = new_column_header @data = data @index_offset = index_offset end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
16 17 18 |
# File 'lib/array_transform/operations/add_index_column.rb', line 16 def data @data end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/array_transform/operations/add_index_column.rb', line 18 def call AddColumn.call( cell_operation: -> (row_index) { row_index + index_offset }, data: data, new_column_header: new_column_header ) end |