Class: Gem::OptionParser::Switch::RequiredArgument

Inherits:
Gem::OptionParser::Switch show all
Defined in:
lib/rubygems/vendor/optparse/lib/optparse.rb

Overview

Switch that takes an argument.

Instance Attribute Summary

Attributes inherited from Gem::OptionParser::Switch

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

Instance Method Summary collapse

Methods inherited from Gem::OptionParser::Switch

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

Constructor Details

This class inherits a constructor from Gem::OptionParser::Switch

Instance Method Details

#parse(arg, argv) ⇒ Object

Raises an exception if argument is not present.



733
734
735
736
737
738
739
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 733

def parse(arg, argv)
  unless arg
    raise MissingArgument if argv.empty?
    arg = argv.shift
  end
  conv_arg(*parse_arg(arg, &method(:raise)))
end

#pretty_headObject

:nodoc:



741
742
743
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 741

def pretty_head           # :nodoc:
  "Required"
end