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



31
32
33
# File 'lib/ruby/rego/cli.rb', line 31

def error
  @error
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



31
32
33
# File 'lib/ruby/rego/cli.rb', line 31

def options
  @options
end

#parserObject

Returns the value of attribute parser

Returns:

  • (Object)

    the current value of parser



31
32
33
# File 'lib/ruby/rego/cli.rb', line 31

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)


47
48
49
50
# File 'lib/ruby/rego/cli.rb', line 47

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)


38
39
40
# File 'lib/ruby/rego/cli.rb', line 38

def success?
  !error
end