简体   繁体   中英

Ruby on rails: printing the variable name for debugging purposes in the console

Lets say I have i variable var witch is a pointer to another variable named user_id.

How do I puts var such that I can see in the console user_id = (whatever the value is)

Reason why I want to do this, is because I want to write a method called print_debug_block, where you give it an array of variables, and it prints in the following format:

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||  
var1 = valOfVar1  
var2 = valOfVar2  
var3 = valOfVar3  
etc  
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM