Class: OptionParser::Switch::OptionalArgument (Ruby 2.2.4)
Description: Class : OptionParser::Switch::OptionalArgument - Ruby 2.2.4

- Home
- Core 2.2.4
- Std-lib 2.2.4
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- optparse.rb

### Parent

self

### Methods

- #parse

### Class/Module Index

Quicksearch

- Object
- OptParse
- OptionParser
- OptionParser::AC
- OptionParser::Acceptables
- OptionParser::AmbiguousArgument
- OptionParser::AmbiguousOption
- OptionParser::Arguable
- OptionParser::CompletingHash
- OptionParser::Completion
- OptionParser::InvalidArgument
- OptionParser::InvalidOption
- OptionParser::List
- OptionParser::MissingArgument
- OptionParser::NeedlessArgument
- OptionParser::OptionMap
- OptionParser::ParseError
- OptionParser::Regexp
- OptionParser::Switch
- OptionParser::Switch::NoArgument
- OptionParser::Switch::OptionalArgument
- OptionParser::Switch::PlacedArgument
- OptionParser::Switch::RequiredArgument

No matching classes.

# OptionParser::Switch::OptionalArgument

Switch that can omit argument.

### Public Instance Methods

parse(arg, argv, &error) click to toggle source

Parses argument if given, or uses default value.

                   # File optparse.rb, line 543
    def parse(arg, argv, &error)
      if arg
        conv_arg(*parse_arg(arg, &error))
      else
        conv_arg(arg)
      end
    end