Class: SkillBench::Services::OptionParserService Deprecated
- Inherits:
-
Object
- Object
- SkillBench::Services::OptionParserService
- Defined in:
- lib/skill_bench/services/option_parser_service.rb
Overview
Deprecated.
Use Cli::RunCommand option parsing instead.
Parses CLI arguments for the EvaluateCommand using Ruby’s OptionParser. Provides standardized error handling for invalid flags and missing arguments.
Class Method Summary collapse
-
.call(argv) ⇒ Hash
Parses command-line options into a hash.
Instance Method Summary collapse
-
#call ⇒ Hash
Parses the arguments and returns a result hash.
-
#initialize(argv) ⇒ OptionParserService
constructor
A new instance of OptionParserService.
Constructor Details
#initialize(argv) ⇒ OptionParserService
Returns a new instance of OptionParserService.
20 21 22 |
# File 'lib/skill_bench/services/option_parser_service.rb', line 20 def initialize(argv) @argv = argv end |
Class Method Details
.call(argv) ⇒ Hash
Parses command-line options into a hash.
15 16 17 |
# File 'lib/skill_bench/services/option_parser_service.rb', line 15 def self.call(argv) new(argv).call end |
Instance Method Details
#call ⇒ Hash
Parses the arguments and returns a result hash.
27 28 29 30 31 32 33 34 35 |
# File 'lib/skill_bench/services/option_parser_service.rb', line 27 def call = {} parser().parse!(@argv) { success: true, response: } rescue OptionParser::ParseError => e { success: false, response: { error: { message: e. } } } end |