Class: Csvtool::Interface::CLI::Workflows::Steps::CsvStats::CollectInputsStep
- Inherits:
-
Object
- Object
- Csvtool::Interface::CLI::Workflows::Steps::CsvStats::CollectInputsStep
- Defined in:
- lib/csvtool/interface/cli/workflows/steps/csv_stats/collect_inputs_step.rb
Instance Method Summary collapse
- #call(context) ⇒ Object
-
#initialize(file_path_prompt:, separator_prompt:, headers_present_prompt:) ⇒ CollectInputsStep
constructor
A new instance of CollectInputsStep.
Constructor Details
#initialize(file_path_prompt:, separator_prompt:, headers_present_prompt:) ⇒ CollectInputsStep
Returns a new instance of CollectInputsStep.
10 11 12 13 14 |
# File 'lib/csvtool/interface/cli/workflows/steps/csv_stats/collect_inputs_step.rb', line 10 def initialize(file_path_prompt:, separator_prompt:, headers_present_prompt:) @file_path_prompt = file_path_prompt @separator_prompt = separator_prompt @headers_present_prompt = headers_present_prompt end |
Instance Method Details
#call(context) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/csvtool/interface/cli/workflows/steps/csv_stats/collect_inputs_step.rb', line 16 def call(context) context[:file_path] = @file_path_prompt.call(label: "CSV file path: ") col_sep = @separator_prompt.call return :halt if col_sep.nil? context[:col_sep] = col_sep context[:headers_present] = @headers_present_prompt.call nil end |