Exception: Converty::CantConvertError
- Defined in:
- lib/converty.rb
Overview
Error thrown when trying to convert between two different types of units, e.g. distance to weight.
Instance Method Summary collapse
-
#initialize(from, to) ⇒ CantConvertError
constructor
A new instance of CantConvertError.
Constructor Details
#initialize(from, to) ⇒ CantConvertError
Returns a new instance of CantConvertError.
12 13 14 15 16 17 |
# File 'lib/converty.rb', line 12 def initialize(from, to) from_unit = UNITS.fetch(from) to_unit = UNITS.fetch(to) = "can't convert #{from_unit.fetch(:type)} (#{from}) to #{to_unit.fetch(:type)} (#{to})" super() end |