Does Ruby offer a mechanism to share variables (more importantly, class objects and any other data abstractions I deem useful for that matter) between different running Ruby processes?
For example if I have a class instantiated, initialized and carefully tuned to a certain state, I want that state to sort of globally be available to all my otherwise independent Ruby and Irb runs throughout the day, outliving the lifetime of the process that initially used it.
One scenario I'm now considering to effectively address this problem is to create a micro Ruby script acting merely as a keeper of my chosen persistent objects and variables for a day, and daemonize it with the daemons gem or similar. Set-up 1st in the morning, tear-down at night at the end of all things.
Throughout the day many instances of another Ruby program--the one containing my actual business logic--would come and go yet be able to use and manipulate my chosen objects kept alive in the daemon process above.
Should I be studying how to serialize complex objects to disk? (actually prefer RAM not disk since it's temporary for a period anyway, and recreating it only costs much time)
$browser = Watir::Browser.new(:firefox)
opens a new browser but sadly, the class offers no built-in ability to detach and re-attach to prior web browser sessions left behind by a previous irb or ruby Watir::Browser instance. Which is why I'm instead looking for a way to keep that object instance itself alive after Ruby exits. – Gastrectomy