module Cucumber::Gherkin::Formatter::Escaping

Public Instance Methods

escape_cell(sym) click to toggle source

Escapes a pipes and backslashes:

  • | becomes |

  • \ becomes \

This is used in the pretty formatter.

# File lib/cucumber/gherkin/formatter/escaping.rb, line 13
def escape_cell(sym)
  sym.gsub(/\\(?!\|)/, '\\\\\\\\').gsub(/\n/, '\\n').gsub(/\|/, '\\|')
end