module RSpec::Core::Formatters::SyntaxHighlighter::CodeRayImplementation

@private

Constants

RESET_CODE

Public Class Methods

# File rspec-core/lib/rspec/core/formatters/syntax_highlighter.rb, line 64
def self.highlight_syntax(lines)
  highlighted = begin
    CodeRay.encode(lines.join("\n"), :ruby, :terminal)
  rescue Support::AllExceptionsExceptOnesWeMustNotRescue
    return lines
  end

  highlighted.split("\n").map do |line|
    line.sub(/\S/) { |char| char.insert(0, RESET_CODE) }
  end
end