Class: OptionParser::Switch::RequiredArgument (Ruby 2.7.2)
Description: Class : OptionParser::Switch::RequiredArgument - Ruby 2.7.2

### Home Classes Methods

### In Files

- optparse.rb

### Parent

self

### Methods

- #parse

### Class/Module Index

Quicksearch

- Object
- 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::RequiredArgument

Switch that takes an argument.

### Public Instance Methods

parse(arg, argv) click to toggle source

Raises an exception if argument is not present.

                   # File optparse.rb, line 698
    def parse(arg, argv)
      unless arg
        raise MissingArgument if argv.empty?
        arg = argv.shift
      end
      conv_arg(*parse_arg(arg, &method(:raise)))
    end