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.



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

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