Raise exception based on parameter type
def inverse(x) raise "Argument is not numeric" unless x.is_a? Numeric 1.0 / x end inverse(2) # => 0.5 inverse('not a number') # RuntimeError: Argument is not numeric