If you want to raise an error if !data.is_a?(String), you can't wrap that code in a if data.is_a?(String)