Threads Ruby

thread = Thread.new do
  t = Thread.current
  t[:var1] = "This is a string"
  t[:var2] = 365
end
x = thread[:var1]               # "This is a string"
y = thread[:var2]               # 365
has_var2 = thread.key?("var2")  # true
has_var3 = thread.key?("var3")  # false