Check out backgroundrb plugin ( http://backgroundrb.rubyforge.org/ )
This is a plugin that can run ruby code in seperate Threats as
so-called "workers", which are basically ruby classes you can run in
You can start and access them through backgroundrb's "MiddleMan"
"The MiddleMan front object has a method that takes
a class type as a symbol and instantiates a new instance of said
class type. Then it returns a job_key to the client(rails). Rails can
then call a method on that object through the MiddleMan class."
Then, until you delete the Worker Instance through MiddleMan, this
thread keeps running in the background, and you can access it by the
worker's unique ID.
As i dont know what exactly you want to achieve, this may be a ver nice
solution or overkill.