Class: RegoValidate::ErrorReporter::TextFormatter
- Inherits:
-
Object
- Object
- RegoValidate::ErrorReporter::TextFormatter
- Defined in:
- lib/ruby/rego/cli/reporting.rb
Overview
Emits text error output for CLI.
Instance Method Summary collapse
-
#error(message, parser = nil) ⇒ void
-
#initialize(stdout:, stderr:) ⇒ TextFormatter
constructor
A new instance of TextFormatter.
-
#rego_error(error) ⇒ void
Constructor Details
#initialize(stdout:, stderr:) ⇒ TextFormatter
Returns a new instance of TextFormatter.
199 200 201 202 |
# File 'lib/ruby/rego/cli/reporting.rb', line 199 def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr end |
Instance Method Details
#error(message, parser = nil) ⇒ void
This method returns an undefined value.
207 208 209 210 |
# File 'lib/ruby/rego/cli/reporting.rb', line 207 def error(, parser = nil) stderr.puts("Error: #{}") stderr.puts(parser) if parser end |
#rego_error(error) ⇒ void
This method returns an undefined value.
214 215 216 217 218 |
# File 'lib/ruby/rego/cli/reporting.rb', line 214 def rego_error(error) location = error.location stderr.puts("Error: #{error.}") stderr.puts(" at #{location}") if location end |