Class: Cure::Transformation::TransformContext

Inherits:
Object
  • Object
show all
Includes:
FileHelpers
Defined in:
lib/cure/transformation/transform.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileHelpers

#clean_dir, #read_file, #with_file, #with_temp_dir

Constructor Details

#initializeTransformContext

Returns a new instance of TransformContext.



89
90
91
92
93
# File 'lib/cure/transformation/transform.rb', line 89

def initialize
  @row_count = 0
  @transformed_rows = []
  @column_headers = {}
end

Instance Attribute Details

#column_headersObject

Returns the value of attribute column_headers.



85
86
87
# File 'lib/cure/transformation/transform.rb', line 85

def column_headers
  @column_headers
end

#row_countObject

Returns the value of attribute row_count.



85
86
87
# File 'lib/cure/transformation/transform.rb', line 85

def row_count
  @row_count
end

#transformed_rowsObject

Returns the value of attribute transformed_rows.



85
86
87
# File 'lib/cure/transformation/transform.rb', line 85

def transformed_rows
  @transformed_rows
end

Instance Method Details

#add_transformed_row(row) ⇒ Object



100
101
102
# File 'lib/cure/transformation/transform.rb', line 100

def add_transformed_row(row)
  @transformed_rows << row
end

#extract_column_headers(row) ⇒ Object

Parameters:

  • row (Array<String>)


96
97
98
# File 'lib/cure/transformation/transform.rb', line 96

def extract_column_headers(row)
  row.each_with_index { |column, idx| @column_headers[column] = idx }
end