def doSomething(value) if (value.is_a?(Integer)) print value * 2 else print \"Error: Expected integer value\" exit end end
No, you can't. You can only do what you're already doing: check the type yourself.