Exception: Convertio::TypeMismatchError
- Inherits:
-
StandardError
- Object
- StandardError
- Convertio::TypeMismatchError
- Defined in:
- lib/convertio.rb
Overview
Raise error if type mismatch
Instance Method Summary collapse
-
#initialize(from_unit, to_unit) ⇒ TypeMismatchError
constructor
A new instance of TypeMismatchError.
Constructor Details
#initialize(from_unit, to_unit) ⇒ TypeMismatchError
Returns a new instance of TypeMismatchError.
19 20 21 22 |
# File 'lib/convertio.rb', line 19 def initialize(from_unit, to_unit) = "This conversion is not allowed: #{from_unit[:name]} is of type #{from_unit.fetch(:type)} but #{to_unit[:name]} is of type #{to_unit.fetch(:type)}" # rubocop:disable Layout/LineLength super() end |