Another useful data structure is Queue. This is a synchronised, i.e. thread safe, first-in first-out queue. This makes it easy to coordinate work between threads. \
Below is a simple example of a program that lets you enter multiple URLs to download, then works through them one by one in the background:
require "thread" # Queue is part of the thread library
require "net/http"
to_do = Queue.new