Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logger.debug ["This is", "an", "Array"] Rails

Why is my output of

logger.debug ["This is", "an", "Array"]

This isanArray

and not something like ["This is", "an", "Array"]

Is there a way to do this? (I know I could do to_yaml, but that is too verbose for me)

What are some options for a nice clean output of an array, similar to print_r in php?

like image 255
Chris Muench Avatar asked Mar 04 '11 16:03

Chris Muench


1 Answers

Try this:

logger.debug ["This is", "an", "Array"].inspect

This also works for all other kinds of objects: Hashes, Classes and so on.

like image 183
Simon Woker Avatar answered Oct 05 '22 21:10

Simon Woker