Module: Cucumber::Gherkin::Formatter::Escaping

Included in:
Formatter::Pretty, MultilineArgument::DataTable::Cells, MultilineArgument::DataTable::DataTablePrinter
Defined in:
lib/cucumber/gherkin/formatter/escaping.rb

Instance Method Summary collapse

Instance Method Details

#escape_cell(sym) ⇒ Object

Escapes a pipes and backslashes:

  • | becomes |

  • \ becomes \

This is used in the pretty formatter.



13
14
15
# File 'lib/cucumber/gherkin/formatter/escaping.rb', line 13

def escape_cell(sym)
  sym.gsub(/\\(?!\|)/, '\\\\\\\\').gsub(/\n/, '\\n').gsub(/\|/, '\\|')
end