Ruby 2.4

OptionParser::Switch::PlacedArgument

class OptionParser::Switch::PlacedArgument

父类:self

切换采用不以' - '开头的参数。

公共实例方法

parse(arg, argv, &error) Show source

如果参数不存在或以' - '开头,则返回nil。

# File lib/optparse.rb, line 704 def parse(arg, argv, &error) if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0])) return nil, block, nil end opt = (val = parse_arg(val, &error))[1] val = conv_arg(*val) if opt and !arg argv.shift else val[0] = nil end val end