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

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

Instance Method Summary collapse

Constructor Details

#initialize(file_path_prompt:, separator_prompt:) ⇒ CollectSourceStep

Returns a new instance of CollectSourceStep.



13
14
15
16
# File 'lib/csvtool/interface/cli/workflows/steps/row_extraction/collect_source_step.rb', line 13

def initialize(file_path_prompt:, separator_prompt:)
  @file_path_prompt = file_path_prompt
  @separator_prompt = separator_prompt
end

Instance Method Details

#call(context) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/csvtool/interface/cli/workflows/steps/row_extraction/collect_source_step.rb', line 18

def call(context)
  context[:file_path] = @file_path_prompt.call
  col_sep = @separator_prompt.call
  return :halt if col_sep.nil?

  context[:col_sep] = col_sep
  nil
end