Class: Cure::Transformation::TransformContext
- Inherits:
-
Object
- Object
- Cure::Transformation::TransformContext
- Includes:
- FileHelpers
- Defined in:
- lib/cure/transformation/transform.rb
Instance Attribute Summary collapse
-
#column_headers ⇒ Object
Returns the value of attribute column_headers.
-
#row_count ⇒ Object
Returns the value of attribute row_count.
-
#transformed_rows ⇒ Object
Returns the value of attribute transformed_rows.
Instance Method Summary collapse
- #add_transformed_row(row) ⇒ Object
- #extract_column_headers(row) ⇒ Object
-
#initialize ⇒ TransformContext
constructor
A new instance of TransformContext.
Methods included from FileHelpers
#clean_dir, #read_file, #with_file, #with_temp_dir
Constructor Details
#initialize ⇒ TransformContext
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_headers ⇒ Object
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_count ⇒ Object
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_rows ⇒ Object
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
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 |