class OptParseBuilder::Argument

The base class for all arguments. You don't create arguments explicitly; they are created by for you when you use the builder API.

Public Instance Methods

optional() click to toggle source

Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn't possible.

# File lib/opt_parse_builder/argument.rb, line 49
def optional
  raise BuildError,
        "cannot convert #{self.class.name} to an optional operand"
end
required() click to toggle source

Convert from a required operand to an optional one, returning a new argument. Raises an error if that isn't possible.

# File lib/opt_parse_builder/argument.rb, line 56
def required
  raise BuildError,
        "cannot convert #{self.class.name} to a required operand"
end
value() click to toggle source

Get an argument's value. Returns nil if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).

# File lib/opt_parse_builder/argument.rb, line 14
def value
end
value=(_v) click to toggle source

Set the argument's value. Does nothing if the argument has no value. This is made public for the use of a handler proc (See ArgumentBuilder#handler).

# File lib/opt_parse_builder/argument.rb, line 20
def value=(_v)
end