Class: Csvtool::Interface::CLI::Workflows::RunCrossCsvDedupeWorkflow
- Inherits:
-
Object
- Object
- Csvtool::Interface::CLI::Workflows::RunCrossCsvDedupeWorkflow
- Defined in:
- lib/csvtool/interface/cli/workflows/run_cross_csv_dedupe_workflow.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(stdin:, stdout:, stderr: stdout, use_case: Application::UseCases::RunCrossCsvDedupe.new) ⇒ RunCrossCsvDedupeWorkflow
constructor
A new instance of RunCrossCsvDedupeWorkflow.
Constructor Details
#initialize(stdin:, stdout:, stderr: stdout, use_case: Application::UseCases::RunCrossCsvDedupe.new) ⇒ RunCrossCsvDedupeWorkflow
Returns a new instance of RunCrossCsvDedupeWorkflow.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/csvtool/interface/cli/workflows/run_cross_csv_dedupe_workflow.rb', line 26 def initialize(stdin:, stdout:, stderr: stdout, use_case: Application::UseCases::RunCrossCsvDedupe.new) @stdin = stdin @stdout = stdout @stderr = stderr @use_case = use_case @errors = Interface::CLI::Errors::Presenter.new(stdout: @stderr) @session_builder = Builders::CrossCsvDedupeSessionBuilder.new @output_destination_mapper = Support::OutputDestinationMapper.new @result_error_handler = Support::ResultErrorHandler.new(errors: @errors) end |
Instance Method Details
#call ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/csvtool/interface/cli/workflows/run_cross_csv_dedupe_workflow.rb', line 37 def call context = { use_case: @use_case, session_builder: @session_builder, output_destination_mapper: @output_destination_mapper, presenter_factory: ->(col_sep:) { Presenters::CrossCsvDedupePresenter.new(stdout: @stdout, col_sep: col_sep) }, handle_error: method(:handle_error) } pipeline = Steps::WorkflowStepPipeline.new(steps: [ Steps::CrossCsvDedupe::CollectProfilesStep.new( file_path_prompt: Interface::CLI::Prompts::FilePathPrompt.new(stdin: @stdin, stdout: @stderr), separator_prompt: Interface::CLI::Prompts::SeparatorPrompt.new(stdin: @stdin, stdout: @stderr, errors: @errors), headers_present_prompt: Interface::CLI::Prompts::HeadersPresentPrompt.new(stdin: @stdin, stdout: @stderr), errors: @errors ), Steps::CrossCsvDedupe::CollectOptionsStep.new( selector_prompt: Interface::CLI::Prompts::DedupeKeySelectorPrompt.new(stdin: @stdin, stdout: @stderr), yes_no_prompt: Interface::CLI::Prompts::YesNoPrompt.new(stdin: @stdin, stdout: @stderr), output_destination_prompt: Interface::CLI::Prompts::OutputDestinationPrompt.new( stdin: @stdin, stdout: @stderr, errors: @errors ), errors: @errors ), Steps::CrossCsvDedupe::ExecuteStep.new ]) pipeline.call(context) rescue ArgumentError => e return @errors.empty_output_path if e. == "file output path cannot be empty" raise e end |