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.



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

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