Class: Toys::ArgParser::FlagValueNotAllowedError

Inherits:
UsageError
  • Object
show all
Defined in:
lib/toys/arg_parser.rb

Overview

A UsageError indicating a value was provided for a flag that does not take a value.

Instance Attribute Summary

Attributes inherited from UsageError

#message, #name, #suggestions, #value

Instance Method Summary collapse

Methods inherited from UsageError

#full_message

Constructor Details

#initialize(message = nil, name: nil) ⇒ FlagValueNotAllowedError

Create a FlagValueNotAllowedError.

Parameters:

  • message (String, nil) (defaults to: nil)

    A custom message. Normally omitted, in which case an appropriate default is supplied.

  • name (String) (defaults to: nil)

    The name of the flag. Normally required.



97
98
99
# File 'lib/toys/arg_parser.rb', line 97

def initialize(message = nil, name: nil)
  super(message || "Flag \"#{name}\" should not take an argument.", name: name)
end