Module: Test::Unit::Options
- Included in:
- GlobOption, LoadPathOption, Runner
- Defined in:
- lib/test/unit.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ Options
A new instance of Options.
- #option_parser ⇒ Object
- #process_args(args = []) ⇒ Object
Instance Method Details
#initialize(&block) ⇒ Options
Returns a new instance of Options.
33 34 35 36 37 |
# File 'lib/test/unit.rb', line 33 def initialize(*, &block) @init_hook = block @options = nil super(&nil) end |
#option_parser ⇒ Object
39 40 41 |
# File 'lib/test/unit.rb', line 39 def option_parser @option_parser ||= OptionParser.new end |
#process_args(args = []) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/test/unit.rb', line 43 def process_args(args = []) return @options if @options orig_args = args.dup = {} opts = option_parser (opts, ) opts.parse!(args) orig_args -= args args = @init_hook.call(args, ) if @init_hook (args, ) @help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " " @options = if @options[:parallel] @files = args @args = orig_args end end |