Class: TTY::Option::UnpermittedArgument
- Inherits:
-
ParseError
- Object
- ParseError
- TTY::Option::UnpermittedArgument
- Defined in:
- lib/tty/option/errors.rb
Overview
Raised when argument value isn’t permitted
Constant Summary collapse
- MESSAGE =
"unpermitted value `%<value>s` for '%<name>s' %<type>s: " \ "choose from %<choices>s"
Instance Attribute Summary
Attributes inherited from ParseError
Instance Method Summary collapse
-
#initialize(param_or_message, value = nil) ⇒ UnpermittedArgument
constructor
A new instance of UnpermittedArgument.
Methods inherited from ParseError
Constructor Details
#initialize(param_or_message, value = nil) ⇒ UnpermittedArgument
Returns a new instance of UnpermittedArgument.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/tty/option/errors.rb', line 144 def initialize(, value = nil) if .is_a?(Parameter) @param = = format(MESSAGE, value: format_value(value), name: param.name, type: param.to_sym, choices: format_choices(param.permit)) else = end super() end |