When I'm running a simple Ruby script, what's the easiest way to dump an object's fields to the console?
I'm looking for something similar to PHP's
print_r() that will work with arrays as well.
-----------------------
Possibly:
puts variable.inspect
Để dump vào file log:
ReplyDeletelogger.info(variable.inspect)
hoặc
Rails.logger.info(variable.inspect)
logger.info "#{variable.inspect}"
ReplyDeleteRails.logger.info "#{variable.inspect}"