Class: Csvtool::Interface::CLI::Workflows::Presenters::RowRandomizationPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/csvtool/interface/cli/workflows/presenters/row_randomization_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, headers:, col_sep:, row_formatter: Output::Formatters::CsvRowFormatter.new) ⇒ RowRandomizationPresenter

Returns a new instance of RowRandomizationPresenter.



11
12
13
14
15
16
# File 'lib/csvtool/interface/cli/workflows/presenters/row_randomization_presenter.rb', line 11

def initialize(stdout:, headers:, col_sep:, row_formatter: Output::Formatters::CsvRowFormatter.new)
  @stdout = stdout
  @headers = headers
  @col_sep = col_sep
  @row_formatter = row_formatter
end

Instance Method Details



18
19
20
21
# File 'lib/csvtool/interface/cli/workflows/presenters/row_randomization_presenter.rb', line 18

def print_console_start
  @stdout.puts
  @stdout.puts @row_formatter.call(fields: @headers, col_sep: @col_sep) if @headers
end


27
28
29
# File 'lib/csvtool/interface/cli/workflows/presenters/row_randomization_presenter.rb', line 27

def print_file_written(path)
  @stdout.puts "Wrote output to #{path}"
end


23
24
25
# File 'lib/csvtool/interface/cli/workflows/presenters/row_randomization_presenter.rb', line 23

def print_row(fields)
  @stdout.puts @row_formatter.call(fields: fields, col_sep: @col_sep)
end