123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Gem::OptionParser::Switch
Defined in: lib/rubygems/optparse/lib/optparse.rb

Overview

::Gem::OptionParser::Switch that can omit argument.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

::Gem::OptionParser::Switch - Inherited

#summarize

Produces the summary text.

#switch_name

Main name of the switch.

#add_banner, #compsys, #match_nonswitch?,
#conv_arg

Parses argument, converts and returns #arg, #block and result of conversion.

#parse_arg

Parses #arg and returns rest of #arg and matched portion to the argument pattern.

Constructor Details

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

Instance Method Details

#parse(arg, argv, &error)

Parses argument if given, or uses default value.

[ GitHub ]

  
# File 'lib/rubygems/optparse/lib/optparse.rb', line 723

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