123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Core::Formatters::SyntaxHighlighter::CodeRayImplementation Private

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: rspec-core/lib/rspec/core/formatters/syntax_highlighter.rb

Constant Summary

Class Method Summary

Class Method Details

.highlight_syntax(lines)

[ GitHub ]

  
# 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