Class: Cucumber::MultilineArgument::DataTable::DataTablePrinter

Inherits:
Object
  • Object
show all
Includes:
Gherkin::Formatter::Escaping
Defined in:
lib/cucumber/multiline_argument/data_table.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Gherkin::Formatter::Escaping

#escape_cell

Constructor Details

#initialize(data_table, indentation, prefixes) ⇒ DataTablePrinter

Returns a new instance of DataTablePrinter.


414
415
416
417
418
# File 'lib/cucumber/multiline_argument/data_table.rb', line 414

def initialize(data_table, indentation, prefixes)
  @data_table = data_table
  @indentation = indentation
  @prefixes = prefixes
end

Instance Method Details

#to_sObject


420
421
422
423
424
425
426
# File 'lib/cucumber/multiline_argument/data_table.rb', line 420

def to_s
  leading_row = "\n"
  end_indentation = indentation - 2
  trailing_row = "\n" + (' ' * end_indentation)
  table_rows = data_table.cell_matrix.map { |row| format_row(row) }
  leading_row + table_rows.join("\n") + trailing_row
end