Exception: GLI::MissingRequiredArgumentsException
- Inherits:
-
BadCommandOptionsOrArguments
- Object
- StandardError
- BadCommandLine
- BadCommandOptionsOrArguments
- GLI::MissingRequiredArgumentsException
- Defined in:
- lib/gli/exceptions.rb
Instance Attribute Summary collapse
-
#num_arguments_received ⇒ Object
readonly
Returns the value of attribute num_arguments_received.
-
#range_arguments_accepted ⇒ Object
readonly
Returns the value of attribute range_arguments_accepted.
Attributes inherited from BadCommandOptionsOrArguments
Instance Method Summary collapse
-
#initialize(command, num_arguments_received, range_arguments_accepted) ⇒ MissingRequiredArgumentsException
constructor
A new instance of MissingRequiredArgumentsException.
Methods inherited from BadCommandLine
Methods included from StandardException
Constructor Details
#initialize(command, num_arguments_received, range_arguments_accepted) ⇒ MissingRequiredArgumentsException
Returns a new instance of MissingRequiredArgumentsException.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/gli/exceptions.rb', line 73 def initialize(command,num_arguments_received,range_arguments_accepted) @num_arguments_received = num_arguments_received @range_arguments_accepted = range_arguments_accepted = if @num_arguments_received < @range_arguments_accepted.min "#{command.name} expected at least #{@range_arguments_accepted.min} arguments, but was given only #{@num_arguments_received}" elsif @range_arguments_accepted.min == 0 "#{command.name} expected no arguments, but received #{@num_arguments_received}" else "#{command.name} expected only #{@range_arguments_accepted.max} arguments, but received #{@num_arguments_received}" end super(,command) end |
Instance Attribute Details
#num_arguments_received ⇒ Object (readonly)
Returns the value of attribute num_arguments_received.
72 73 74 |
# File 'lib/gli/exceptions.rb', line 72 def num_arguments_received @num_arguments_received end |
#range_arguments_accepted ⇒ Object (readonly)
Returns the value of attribute range_arguments_accepted.
72 73 74 |
# File 'lib/gli/exceptions.rb', line 72 def range_arguments_accepted @range_arguments_accepted end |