Skip to content

Instantly share code, notes, and snippets.

@ylansegal
Created March 18, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylansegal/1e37c0fb37b5dc084857 to your computer and use it in GitHub Desktop.
Save ylansegal/1e37c0fb37b5dc084857 to your computer and use it in GitHub Desktop.
Use Thread.current
>> 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