class KXI::Exceptions::InvalidTypeException
Raised when some value is of unexpected type
Public Class Methods
new(act, *exp)
click to toggle source
Instantiates the [KXI::Exceptions::InvalidTypeException] class @param exp [Array<Class>] Expected types @param act [Class] Actual type
Calls superclass method
# File lib/kxi/exceptions/invalid_type_exception.rb, line 22 def initialize(act, *exp) if exp.length == 1 super("Value is of unexpected type! Expected <#{exp[0].name}> got <#{act.name}>") else super("Value is of unexpected type! Expected { #{exp.collect {|i| "<#{i}>"}.join(', ')} } got <#{act.name}>") end @exp = exp @act = act end
Public Instance Methods
actual()
click to toggle source
Returns actual type @return [Class] Actual type
# File lib/kxi/exceptions/invalid_type_exception.rb, line 15 def actual @act end
expected()
click to toggle source
Returns expected types @return [Array<Class>] Expected types
# File lib/kxi/exceptions/invalid_type_exception.rb, line 9 def expected @exp end