Sha256: 0d3d66433502410d90f89c20fd7d4c0014a693a2670f6e5723ba16323c87f62d

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

module Rake::TeamCity::MessageFactory
  # Can't use gsub! in Opal and removed copy_of_text.encode!('UTF-8') if copy_of_text.respond_to? :encode! since we don't exactly have encoding
  def self.replace_escaped_symbols(text)
    copy_of_text = String.new(text)

    copy_of_text = copy_of_text.gsub(/\|/, "||")

    copy_of_text = copy_of_text.gsub(/'/, "|'")
    copy_of_text = copy_of_text.gsub(/\n/, "|n")
    copy_of_text = copy_of_text.gsub(/\r/, "|r")
    copy_of_text = copy_of_text.gsub(/\]/, "|]")

    copy_of_text = copy_of_text.gsub(/\[/, "|[")

    begin
      copy_of_text = copy_of_text.gsub(/\u0085/, "|x") # next line
      copy_of_text = copy_of_text.gsub(/\u2028/, "|l") # line separator
      copy_of_text = copy_of_text.gsub(/\u2029/, "|p") # paragraph separator
    rescue
      # it is not an utf-8 compatible string :(
    end

    copy_of_text
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-rspec-formatter-1.0.1 opal/opal/rspec/formatters/teamcity/message_factory.rb
opal-rspec-formatter-1.0.0 opal/opal/rspec/formatters/teamcity/message_factory.rb