Sha256: a0323871a16eea53cebd93332640cd802975e3bd3606dd7f83d4021c6f873a64

Contents?: true

Size: 381 Bytes

Versions: 5

Compression:

Stored size: 381 Bytes

Contents

# frozen_string_literal: true
module Cucumber
module Gherkin
  module Formatter
    module Escaping
      # Escapes a pipes and backslashes:
      #
      # * | becomes \|
      # * \ becomes \\
      #
      # This is used in the pretty formatter.
      def escape_cell(s)
        s.gsub(/\\(?!\|)/, '\\\\\\\\').gsub(/\n/, '\\n').gsub(/\|/, '\\|')
      end
    end
  end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber-3.1.0 lib/cucumber/gherkin/formatter/escaping.rb
cucumber-3.0.2 lib/cucumber/gherkin/formatter/escaping.rb
cucumber-3.0.1 lib/cucumber/gherkin/formatter/escaping.rb
cucumber-3.0.0 lib/cucumber/gherkin/formatter/escaping.rb
cucumber-3.0.0.pre.2 lib/cucumber/gherkin/formatter/escaping.rb