Swapping regex case statement for if/then is_a?