Module: Gherkin::Formatter::Escaping

Included in:
PrettyFormatter
Defined in:
lib/gherkin/formatter/escaping.rb

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.



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

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