Class: ConsoleUtils::JSONOutput::JqFormatter

Inherits:
BaseFormatter show all
Defined in:
lib/console_utils/json_output/jq_formatter.rb

Overview

The jq formatter uses the external jq utility.

Instance Method Summary collapse

Methods inherited from BaseFormatter

#call, #format_with_fallback

Instance Method Details

#format(body) ⇒ Object

:nodoc:

Raises:


9
10
11
12
13
14
15
# File 'lib/console_utils/json_output/jq_formatter.rb', line 9

def format(body) #:nodoc:
  output, err, s = Open3.capture3(jq_command, stdin_data: body)

  raise ParseError, err.squish unless s.success?

  output
end