Use Kernel's local_variables method : local_variables « Reflection « Ruby
- Ruby
- Reflection
- local_variables
Use Kernel's local_variables method
$ship = "P"
@friend_1 = "M"
@friend_2 = "J"
bad_chap = "G"
p local_variables
Related examples in the same category