Class: RegoValidate::ErrorReporter::JsonFormatter
- Inherits:
-
Object
- Object
- RegoValidate::ErrorReporter::JsonFormatter
- Defined in:
- lib/ruby/rego/cli.rb
Overview
Emits JSON-formatted error output.
Instance Method Summary collapse
-
#error(message, _parser = nil) ⇒ void
-
#initialize(stdout:, stderr:) ⇒ JsonFormatter
constructor
A new instance of JsonFormatter.
-
#rego_error(error) ⇒ void
Constructor Details
#initialize(stdout:, stderr:) ⇒ JsonFormatter
Returns a new instance of JsonFormatter.
1037 1038 1039 1040 |
# File 'lib/ruby/rego/cli.rb', line 1037 def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr end |
Instance Method Details
#error(message, _parser = nil) ⇒ void
This method returns an undefined value.
1045 1046 1047 1048 |
# File 'lib/ruby/rego/cli.rb', line 1045 def error(, _parser = nil) payload = ErrorPayload.from_cli_error().to_h stdout.puts(JSON.generate(payload)) end |
#rego_error(error) ⇒ void
This method returns an undefined value.
1052 1053 1054 1055 |
# File 'lib/ruby/rego/cli.rb', line 1052 def rego_error(error) payload = ErrorPayload.from_rego_error(error).to_h stdout.puts(JSON.generate(payload)) end |