logger.debug [“ This is”,“ an”,“ Array”] Rails

Chr*_*nch 5 ruby-on-rails

为什么我的输出是

logger.debug ["This is", "an", "Array"]
Run Code Online (Sandbox Code Playgroud)

这个isanArray

而不是类似[“ This is”,“ an”,“ Array”]

有没有办法做到这一点?(我知道我可以做to_yaml,但这对我来说太冗长了)

类似于php中的print_r的数组的干净输出有哪些选择?

Sim*_*ker 5

尝试这个:

logger.debug ["This is", "an", "Array"].inspect
Run Code Online (Sandbox Code Playgroud)

这也适用于所有其他类型的对象:哈希,类等。