Class: RegoValidate::SourceLoader

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

Overview

Loads policy and config sources based on CLI options.

Instance Method Summary collapse

Constructor Details

#initialize(options:, reporter:, parser:) ⇒ SourceLoader

Returns a new instance of SourceLoader.

Parameters:



435
436
437
438
# File 'lib/ruby/rego/cli.rb', line 435

def initialize(options:, reporter:, parser:)
  @options = options
  @loader = ConfigLoader.new(reporter: reporter, parser: parser, yaml_aliases: options.yaml_aliases)
end

Instance Method Details

#loadArray<(String, ConfigLoadResult)>

Returns:



441
442
443
444
445
446
# File 'lib/ruby/rego/cli.rb', line 441

def load
  policy_source = load_policy_source
  return [nil, ConfigLoadResult.new(success: false)] unless policy_source

  [policy_source, load_config]
end