Class: Pry::SyntaxHighlighter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pry/syntax_highlighter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • ?.?.?

Class Method Summary collapse

Class Method Details

.highlight(code, language = :ruby) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • ?.?.?


9
10
11
# File 'lib/pry/syntax_highlighter.rb', line 9

def self.highlight(code, language = :ruby)
  tokenize(code, language).term
end

.keyword_token_colorObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • ?.?.?


17
18
19
# File 'lib/pry/syntax_highlighter.rb', line 17

def self.keyword_token_color
  CodeRay::Encoders::Terminal::TOKEN_COLORS[:keyword]
end

.overwrite_coderay_comment_token!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Sets comment token to blue (black by default), so it's more legible.

Since:

  • ?.?.?


22
23
24
# File 'lib/pry/syntax_highlighter.rb', line 22

def self.overwrite_coderay_comment_token!
  CodeRay::Encoders::Terminal::TOKEN_COLORS[:comment][:self] = "\e[1;34m"
end

.tokenize(code, language = :ruby) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • ?.?.?


13
14
15
# File 'lib/pry/syntax_highlighter.rb', line 13

def self.tokenize(code, language = :ruby)
  CodeRay.scan(code, language)
end