class RSpec::Core::Source::SyntaxHighlighter

@private Provides terminal syntax highlighting of code snippets when coderay is available.

Constants

WindowsImplementation

@private

Public Class Methods

new(configuration) click to toggle source
# File lib/rspec/core/source/syntax_highlighter.rb, line 8
def initialize(configuration)
  @configuration = configuration
end

Public Instance Methods

highlight(lines) click to toggle source
# File lib/rspec/core/source/syntax_highlighter.rb, line 12
def highlight(lines)
  implementation.highlight_syntax(lines)
end

Private Instance Methods

color_enabled_implementation() click to toggle source
# File lib/rspec/core/source/syntax_highlighter.rb, line 31
def color_enabled_implementation
  @color_enabled_implementation ||= begin
    require 'coderay'
    CodeRayImplementation
  rescue LoadError
    NoSyntaxHighlightingImplementation
  end
end
implementation() click to toggle source

:nocov:

# File lib/rspec/core/source/syntax_highlighter.rb, line 20
def implementation
  WindowsImplementation
end