Module: Test::Unit::Options

Included in:
Runner
Defined in:
lib/test/unit.rb

Overview

:nodoc: all

Instance Method Summary collapse

Instance Method Details

#initialize(&block) ⇒ Object



39
40
41
42
43
# File 'lib/test/unit.rb', line 39

def initialize(*, &block)
  @init_hook = block
  @options = nil
  super(&nil)
end

#option_parserObject



45
46
47
# File 'lib/test/unit.rb', line 45

def option_parser
  @option_parser ||= OptionParser.new
end

#process_args(args = []) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/test/unit.rb', line 49

def process_args(args = [])
  return @options if @options
  orig_args = args.dup
  options = {}
  opts = option_parser
  setup_options(opts, options)
  opts.parse!(args)
  orig_args -= args
  args = @init_hook.call(args, options) if @init_hook
  non_options(args, options)
  @help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
  @options = options
  if @options[:parallel]
    @files = args
    @args = orig_args
  end
  options
end