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
-
RESET_CODE =
# File 'rspec-core/lib/rspec/core/formatters/syntax_highlighter.rb', line 62"\e[0m"
Class Method Summary
- .highlight_syntax(lines) Internal use only
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