class Converty::CantConvertError

Error thrown when trying to convert between two different types of units, e.g. distance to weight.

Public Class Methods

new(from, to) click to toggle source
Calls superclass method
# File lib/converty.rb, line 12
def initialize(from, to)
  from_unit = UNITS.fetch(from)
  to_unit = UNITS.fetch(to)
  message = "can't convert #{from_unit.fetch(:type)} (#{from}) to #{to_unit.fetch(:type)} (#{to})"
  super(message)
end