Class: Cucumber::MultilineArgument::DataTable::DataTablePrinter
- Inherits:
-
Object
- Object
- Cucumber::MultilineArgument::DataTable::DataTablePrinter
- Includes:
- Gherkin::Formatter::Escaping
- Defined in:
- lib/cucumber/multiline_argument/data_table.rb
Instance Method Summary collapse
-
#initialize(data_table, indentation, prefixes) ⇒ DataTablePrinter
constructor
A new instance of DataTablePrinter.
- #to_s ⇒ Object
Methods included from Gherkin::Formatter::Escaping
Constructor Details
#initialize(data_table, indentation, prefixes) ⇒ DataTablePrinter
Returns a new instance of DataTablePrinter.
404 405 406 407 408 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 404 def initialize(data_table, indentation, prefixes) @data_table = data_table @indentation = indentation @prefixes = prefixes end |
Instance Method Details
#to_s ⇒ Object
410 411 412 413 414 415 416 |
# File 'lib/cucumber/multiline_argument/data_table.rb', line 410 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 |