We can assign a thread-local variable on Ruby, like so:
Thread.current[:foo] = 1
Thread.current[:bar] = 2
But how do we list / enumerate those variables at a later time?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the keys using
Thread#keys:Don’t know how that’s helpful though, because you should know which keys you use.