Module: Test::Unit::Options

Included in:
GlobOption, LoadPathOption, Runner
Defined in:
lib/test/unit.rb

Instance Method Summary collapse

Instance Method Details

#initialize(&block) ⇒ 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_parserObject



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
  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