Class: PRWithParams::ConfigParser

Inherits:
Object
  • Object
show all
Defined in:
lib/pr_with_params/config_parser.rb

Defined Under Namespace

Classes: ParserError

Constant Summary collapse

VALID_CONFIG_KEYS =

Constants

%i[validators base_branch template title labels assignees].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file_path:, scope: nil) ⇒ ConfigParser

Returns a new instance of ConfigParser.



13
14
15
16
# File 'lib/pr_with_params/config_parser.rb', line 13

def initialize(config_file_path:, scope: nil)
  @config_file_path = config_file_path
  @scope = scope&.to_sym || :default
end

Instance Attribute Details

#config_file_pathObject (readonly)

Attributes



8
9
10
# File 'lib/pr_with_params/config_parser.rb', line 8

def config_file_path
  @config_file_path
end

#filtered_configObject (readonly)

Attributes



8
9
10
# File 'lib/pr_with_params/config_parser.rb', line 8

def filtered_config
  @filtered_config
end

#parsed_configObject (readonly)

Attributes



8
9
10
# File 'lib/pr_with_params/config_parser.rb', line 8

def parsed_config
  @parsed_config
end

#scopeObject (readonly)

Attributes



8
9
10
# File 'lib/pr_with_params/config_parser.rb', line 8

def scope
  @scope
end

Instance Method Details

#parse!Object



18
19
20
21
# File 'lib/pr_with_params/config_parser.rb', line 18

def parse!
  validate_file_type!
  parse_yaml_config
end