Class: TTY::Option::InvalidConversionArgument

Inherits:
ParseError
  • Object
show all
Defined in:
lib/tty/option/errors.rb

Overview

Raised when conversion provided with unexpected argument

Constant Summary collapse

MESSAGE =
"cannot convert value of `%<value>s` into '%<cast>s' type " \
"for '%<name>s' %<type>s"

Instance Attribute Summary

Attributes inherited from ParseError

#param

Instance Method Summary collapse

Methods inherited from ParseError

#format_value

Constructor Details

#initialize(param, value) ⇒ InvalidConversionArgument

Returns a new instance of InvalidConversionArgument.



104
105
106
107
108
109
# File 'lib/tty/option/errors.rb', line 104

def initialize(param, value)
  @param = param
  message = format(MESSAGE, value: value, cast: param.convert,
                    name: param.name, type: param.to_sym)
  super(message)
end