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

Constructor Details

#initialize(param, value) ⇒ InvalidConversionArgument

Returns a new instance of InvalidConversionArgument.


88
89
90
91
92
93
# File 'lib/tty/option/errors.rb', line 88

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