Class: Cure::Transformation::Transform
- Inherits:
-
Object
- Object
- Cure::Transformation::Transform
show all
- Includes:
- FileHelpers, Log
- Defined in:
- lib/cure/transformation/transform.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#clean_dir, #read_file, #with_file, #with_temp_dir
Methods included from Log
#log_debug, #log_error, #log_info, #log_warn
Constructor Details
#initialize(candidates) ⇒ Transform
17
18
19
|
# File 'lib/cure/transformation/transform.rb', line 17
def initialize(candidates)
@candidates = candidates
end
|
Instance Attribute Details
#candidates ⇒ Array<Candidate>
14
15
16
|
# File 'lib/cure/transformation/transform.rb', line 14
def candidates
@candidates
end
|
Instance Method Details
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/cure/transformation/transform.rb', line 30
def (file_contents)
ctx = TransformContext.new
parse_content(ctx, file_contents, header: :none) do |row|
if ctx.row_count == 1
ctx.extract_column_headers(row)
next
end
row = transform(ctx.column_headers, row)
ctx.add_transformed_row(row)
end
ctx
end
|
23
24
25
26
|
# File 'lib/cure/transformation/transform.rb', line 23
def (csv_file_location)
file_contents = read_file(csv_file_location)
(file_contents)
end
|