Class: OptionParser::Switch::PlacedArgument
- Inherits:
-
OptionParser::Switch
- Object
- OptionParser::Switch
- OptionParser::Switch::PlacedArgument
- Defined in:
- lib/optparse.rb
Overview
Switch that takes an argument, which does not begin with ‘-’ or is ‘-’.
Instance Attribute Summary
Attributes inherited from OptionParser::Switch
#arg, #block, #conv, #desc, #long, #pattern, #short
Instance Method Summary collapse
-
#parse(arg, argv, &error) ⇒ Object
Returns nil if argument is not present or begins with ‘-’ and is not ‘-’.
-
#pretty_head ⇒ Object
:nodoc:.
Methods inherited from OptionParser::Switch
#add_banner, #compsys, guess, incompatible_argument_styles, #initialize, #match_nonswitch?, #omitted_argument, pattern, #pretty_print, #pretty_print_contents, #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 ‘-’ and is not ‘-’.
784 785 786 787 788 789 790 791 792 793 794 795 796 797 |
# File 'lib/optparse.rb', line 784 def parse(arg, argv, &error) if !(val = arg) and (argv.empty? or /\A-./ =~ (val = argv[0])) return nil, block end opt = (val = parse_arg(val, &error))[1] val = conv_arg(*val) if opt and !arg argv.shift else omitted_argument val val[0] = nil end val end |
#pretty_head ⇒ Object
:nodoc:
799 800 801 |
# File 'lib/optparse.rb', line 799 def pretty_head # :nodoc: "Placed" end |