Use Thread.current
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Thread.current[:your_variable] = 3 | |
=> 3 | |
>> puts Thread.current[:your_variable].to_i + 1 | |
4 | |
=> nil | |
>> Thread.new { puts Thread.current[:your_variable].to_i + 1 }.join | |
1 | |
=> #<Thread:0x007fa68d94d870@(irb):18 dead> | |
>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment