Class: Toys::ArgParser::ExtraArgumentsError

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

Overview

A UsageError indicating extra arguments were supplied.

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, value: nil, values: nil) ⇒ ExtraArgumentsError

Create an ExtraArgumentsError.

Parameters:

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

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

  • value (String) (defaults to: nil)

    The first extra argument. Normally required.

  • values (Array<String>) (defaults to: nil)

    All extra arguments. Normally required.



227
228
229
# File 'lib/toys/arg_parser.rb', line 227

def initialize(message = nil, value: nil, values: nil)
  super(message || "Extra arguments: \"#{Array(values).join(' ')}\".", value: value)
end