I have a method which outputs api reponse. The response could be either a JSON
response or non-JSON response. For JSON response, my code is as follows:
def process if success? JSON.parse(response.body) else handle_failure end end
And for non-JSON response, I used 'eval' as:
def process if success? eval(response.body) else handle_failure end end
But since response could be anything, how can I make sure that it prints the response in both case?
Thanks