Class: Csvtool::Interface::CLI::Workflows::Steps::RowExtraction::ReadHeadersStep

Inherits:
Object
  • Object
show all
Defined in:
lib/csvtool/interface/cli/workflows/steps/row_extraction/read_headers_step.rb

Instance Method Summary collapse

Instance Method Details

#call(context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/csvtool/interface/cli/workflows/steps/row_extraction/read_headers_step.rb', line 10

def call(context)
  result = context.fetch(:use_case).read_headers(
    file_path: context.fetch(:file_path),
    col_sep: context.fetch(:col_sep)
  )
  unless result.ok?
    context.fetch(:handle_error).call(result)
    return :halt
  end

  context[:headers] = result.data[:headers]
  nil
end