Created
March 18, 2015 21:55
-
-
Save ylansegal/1e37c0fb37b5dc084857 to your computer and use it in GitHub Desktop.
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