Class: Insta::SyntaxHighlight
- Inherits:
-
Object
- Object
- Insta::SyntaxHighlight
- Defined in:
- lib/insta/syntax_highlight.rb,
sig/insta/syntax_highlight.rbs
Class Method Summary collapse
-
.highlight(code, colorable: true) ⇒ String
: (String, ?colorable: bool) -> String.
Class Method Details
.highlight(code, colorable: true) ⇒ String
: (String, ?colorable: bool) -> String
12 13 14 15 16 17 18 |
# File 'lib/insta/syntax_highlight.rb', line 12 def self.highlight(code, colorable: true) return code unless colorable && defined?(IRB::Color) IRB::Color.colorize_code(code, complete: false, colorable: true) rescue StandardError code end |