Class: SimpleCovMcp::ConfigParser

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

Overview

Centralized configuration parser for both CLI and MCP modes Parses argv (which should already include environment options merged by caller)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ ConfigParser

Returns a new instance of ConfigParser.



12
13
14
15
# File 'lib/simplecov_mcp/config_parser.rb', line 12

def initialize(argv)
  @argv = argv
  @config = AppConfig.new
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv.



10
11
12
# File 'lib/simplecov_mcp/config_parser.rb', line 10

def argv
  @argv
end

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/simplecov_mcp/config_parser.rb', line 10

def config
  @config
end

Class Method Details

.parse(argv) ⇒ AppConfig

Parse argv (with env opts already merged) and return config

Parameters:

  • argv (Array<String>)

    command-line arguments (should include env opts if needed)

Returns:

  • (AppConfig)

    populated configuration object



20
21
22
# File 'lib/simplecov_mcp/config_parser.rb', line 20

def self.parse(argv)
  new(argv).parse
end

Instance Method Details

#parseObject



24
25
26
27
28
29
30
# File 'lib/simplecov_mcp/config_parser.rb', line 24

def parse
  # Build and execute the option parser
  parser = OptionParserBuilder.new(config).build_option_parser
  parser.parse!(argv)

  config
end