Class: Pry::SyntaxHighlighter Private
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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.
Class Method Summary collapse
- .highlight(code, language = :ruby) ⇒ Object private
- .keyword_token_color ⇒ Object private
-
.overwrite_coderay_comment_token! ⇒ Object
private
Sets comment token to blue (black by default), so it’s more legible.
- .tokenize(code, language = :ruby) ⇒ Object private
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.
9 10 11 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/syntax_highlighter.rb', line 9 def self.highlight(code, language = :ruby) tokenize(code, language).term end |
.keyword_token_color ⇒ 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.
17 18 19 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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.
22 23 24 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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.
13 14 15 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/syntax_highlighter.rb', line 13 def self.tokenize(code, language = :ruby) CodeRay.scan(code, language) end |