Class: OptionParser::Switch::RequiredArgument
- Inherits:
-
OptionParser::Switch
- Object
- OptionParser::Switch
- OptionParser::Switch::RequiredArgument
- Defined in:
- lib/optparse.rb
Overview
Switch that takes an argument.
Instance Attribute Summary
Attributes inherited from OptionParser::Switch
#arg, #block, #conv, #desc, #long, #pattern, #short
Instance Method Summary collapse
-
#parse(arg, argv, &_) ⇒ Object
Raises an exception if argument is not present.
-
#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, &_) ⇒ Object
Raises an exception if argument is not present.
742 743 744 745 746 747 748 |
# File 'lib/optparse.rb', line 742 def parse(arg, argv, &_) unless arg raise MissingArgument if argv.empty? arg = argv.shift end conv_arg(*parse_arg(arg, &method(:raise))) end |
#pretty_head ⇒ Object
:nodoc:
750 751 752 |
# File 'lib/optparse.rb', line 750 def pretty_head # :nodoc: "Required" end |