Class: FlakyTester::CommandParser
- Inherits:
-
Object
- Object
- FlakyTester::CommandParser
- Defined in:
- lib/flaky_tester/command_parser.rb,
lib/flaky_tester/command_parser/errors/invalid_times.rb
Defined Under Namespace
Classes: Errors
Constant Summary collapse
- DEFAULT_COMMAND_OPTIONS =
{ times: 25, paths: [] }.freeze
Instance Method Summary collapse
-
#initialize(command_args = []) ⇒ CommandParser
constructor
A new instance of CommandParser.
- #parse ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(command_args = []) ⇒ CommandParser
Returns a new instance of CommandParser.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/flaky_tester/command_parser.rb', line 12 def initialize(command_args = []) @command_args = command_args @command_options = DEFAULT_COMMAND_OPTIONS.dup @option_parser = OptionParser.new do |option_parser| option_parser. = "Usage: fspec [options] [files or directories]" end set_times_option_handler set_help_option_handler end |
Instance Method Details
#parse ⇒ Object
23 24 25 26 27 |
# File 'lib/flaky_tester/command_parser.rb', line 23 def parse @option_parser.parse!(@command_args) set_paths_command_option @command_options end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/flaky_tester/command_parser.rb', line 29 def to_s @option_parser.to_s end |