I keep a (badly in need of an update!) repo of BBEdit stuff[1], it's mainly Ruby. I guess BBEdit runs the script in a similar way to a shell in that it's the shebang line that matters most. If your system supports it, then I believe BBEdit will support it. Downloading it for a wee look and having the manual open[2] while you try is well worth it.
[1] https://github.com/yb66/BBEdit-stuff/
[2] https://www.barebones.com/support/bbedit/manual.html