PostgreSQL is an amazing platform for deploying code. But although it supports many languages, the Ruby language options has languished and is AFAICT unusable.
Until some kind soul resurrects it, I am exploring using Opal to compile Ruby code into Javascript using the V8 engine, which is very well-supported on Postgres.
My ideal would be to have a single compile function I can call in Postgres, because I can then easily use that to let me write Ruby stored procedures. Absent that, I'll settle for being able to compile externally.
PLv8 on Postgres offers a persistent object that I could load libraries onto. So I think I can make this work if I can get maybe a single library file that defines a single Opal object, and then I can compile all the things. But I think I need to be able to do a minimal compile that doesn't assume much more than the presence of V8 — no browser, no node, no node standard libraries (not sure about how much of this I can work around, just offering theories).
So: how do I use Opal-generated JS on Postgres?