The question is in the title.
My parameter can be either a string or a character and depending on what I want to do different things for. Is there a way to test this in Ruby?
def foo(arg) if arg.is_a?(Symbol) do_symbol_stuff else do_string_stuff end end
Another solution
def foo(arg) case arg when Symbol do symbol stuff when String do string stuff else do error stuff end end