Class: Trace2::Options
- Inherits:
-
Object
- Object
- Trace2::Options
- Defined in:
- lib/trace2/options.rb
Overview
Defines and returns options for Trace2’s runner, given the arguments that were passed rubocop:disable Metrics/ClassLength
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(option_parser: Trace2::OptionParser.new, kernel: Kernel) ⇒ Options
constructor
rubocop:disable Metrics/MethodLength.
-
#parse(args) ⇒ Object
rubocop:enable Metrics/MethodLength.
Constructor Details
#initialize(option_parser: Trace2::OptionParser.new, kernel: Kernel) ⇒ Options
rubocop:disable Metrics/MethodLength
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/trace2/options.rb', line 13 def initialize(option_parser: Trace2::OptionParser.new, kernel: Kernel) = @kernel = kernel @option_parser = option_parser help_option version_option filter_option output_path_option type_option format_option manual_option end |
Class Method Details
.parse(args) ⇒ Object
8 9 10 |
# File 'lib/trace2/options.rb', line 8 def self.parse(args) new.parse(args) end |
Instance Method Details
#parse(args) ⇒ Object
rubocop:enable Metrics/MethodLength
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/trace2/options.rb', line 28 def parse(args) trace2, executable_args = @option_parser.split_executables(args) executable = executable_args.shift @option_parser.parse(trace2) raise_missing_executable if executable.nil? .merge(executable: executable, args: executable_args) end |