G'day guys,
Currently having a bit of a philsophical conundrum. Myself and a few mates have built a quite awesome ruby CLI script for parsing and managing data. It uses gems, responds to requests and is fully functional and great.
I was wondering if there was any way I could hold a singleton instance of this class and interact with it via a web interface built in rails. I've got a decent amount of rails experience but can't for the life of me figure how how to create a singleton instance in a web-app and how to make that universally accessible to all of the classes/controllers.
The reason I need to create a singleton is that I need to load in a bunch of data that this little script chops and changes. It's class-based, but I don't want to port those classes over to using activerecord if I don't have to, as it keeps everything in memory (and it doesn't take up that much memory).
Is there any way I can just import the script, start it up with the requisite commands and then hold that object in memory for the life of the web application, or would I have to port over the classes/methods to AR or controller methods?
Cheers