[フレーム]

Class: OptionParser::Switch::PlacedArgument

Inherits:
OptionParser::Switch show all
Defined in:
opal/stdlib/optparse.rb

Overview

Switch that takes an argument, which does not begin with '-'.

Instance Attribute Summary

Attributes inherited from OptionParser::Switch

#arg , #block , #conv , #desc , #long , #pattern , #short

Instance Method Summary collapse

Methods inherited from OptionParser::Switch

#add_banner , #compsys , guess , incompatible_argument_styles , #initialize , #match_nonswitch? , pattern , #summarize , #switch_name

Constructor Details

This class inherits a constructor from OptionParser::Switch

Instance Method Details

#parse(arg, argv, &error) ⇒ Object

Returns nil if argument is not present or begins with '-'.

738
739
740
741
742
743
744
745
746
747
748
749
750
# File 'opal/stdlib/optparse.rb', line 738
def parse(arg, argv, &error)
 if !(val = arg) && (argv.empty? || /\A-/ =~ (val = argv[0]))
 return nil, block, nil
 end
 opt = (val = parse_arg(val, &error))[1]
 val = conv_arg(*val)
 if opt && !arg
 argv.shift
 else
 val[0] = nil
 end
 val
end

AltStyle によって変換されたページ (->オリジナル) /