Class: Gem::OptionParser::Switch::OptionalArgument

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

Overview

Switch that can omit 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, &error) ⇒ Object

Parses argument if given, or uses default value.



754
755
756
757
758
759
760
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 754

def parse(arg, argv, &error)
  if arg
    conv_arg(*parse_arg(arg, &error))
  else
    conv_arg(arg)
  end
end

#pretty_headObject

:nodoc:



762
763
764
# File 'lib/rubygems/vendor/optparse/lib/optparse.rb', line 762

def pretty_head           # :nodoc:
  "Optional"
end