Class: RegoValidate::ParseResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/ruby/rego/cli.rb,
lib/ruby/rego/cli.rb

Overview

Parsed options plus parser state and error details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



36
37
38
# File 'lib/ruby/rego/cli.rb', line 36

def error
  @error
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



36
37
38
# File 'lib/ruby/rego/cli.rb', line 36

def options
  @options
end

#parserObject

Returns the value of attribute parser

Returns:

  • (Object)

    the current value of parser



36
37
38
# File 'lib/ruby/rego/cli.rb', line 36

def parser
  @parser
end

Instance Method Details

#report_error(stdout:, stderr:) ⇒ void

This method returns an undefined value.

Report the parse error using the configured output format.

Parameters:

  • stdout (IO)
  • stderr (IO)


52
53
54
55
# File 'lib/ruby/rego/cli.rb', line 52

def report_error(stdout:, stderr:)
  reporter = ErrorReporter.new(stdout: stdout, stderr: stderr, format: options.format)
  reporter.error(error_message, parser)
end

#success?Boolean

Check whether parsing succeeded.

Returns:

  • (Boolean)


43
44
45
# File 'lib/ruby/rego/cli.rb', line 43

def success?
  !error
end