Module: Whoop::Formatters::JsonFormatter
- Defined in:
- lib/whoop/formatters/json_formatter.rb
Class Method Summary collapse
-
.format(message, colorize: false) ⇒ String
Format the SQL query.
Class Method Details
.format(message, colorize: false) ⇒ String
Format the SQL query
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/whoop/formatters/json_formatter.rb', line 12 def self.format(, colorize: false) pretty_json = JSON.pretty_generate() return pretty_json unless colorize formatter = Rouge::Formatters::TerminalTruecolor.new lexer = Rouge::Lexers::JSON.new [ "json:\n\n".colorize(:light_black).underline, formatter.format(lexer.lex(pretty_json)) ].join end |