Method: Fast.highlight
- Defined in:
- lib/fast/cli.rb
.highlight(node, show_sexp: false, colorize: true, sql: false) ⇒ Object
Highligh some source code based on the node. Useful for printing code with syntax highlight.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fast/cli.rb', line 20 def highlight(node, show_sexp: false, colorize: true, sql: false) output = if node.respond_to?(:loc) && !show_sexp wrap_source_range(node).source else node end return output unless colorize CodeRay.scan(output, sql ? :sql : :ruby).term end |