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

Instance Method Summary collapse

Instance Method Details

#escape_cell(s) ⇒ 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(s)
  s.gsub(/\\(?!\|)/, '\\\\\\\\').gsub(/\n/, '\\n').gsub(/\|/, '\\|')
end