module Cucumber::Gherkin::Formatter::Escaping

Public Instance Methods

escape_cell(s) 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 11
def escape_cell(s)
  s.gsub(/\\(?!\|)/, "\\\\\\\\").gsub(/\n/, "\\n").gsub(/\|/, "\\|")
end