def inverse(x) raise "Argument is not numeric" unless x.is_a? Numeric 1.0 / xendinverse(2) # => 0.5inverse('not a number')# RuntimeError: Argument is not numeric