Reputation: 97
I am looking to implement 'https://github.com/LIFX/lifx-gem' commands on a Node.js server and was wondering how to complete this task.
My basic question is more generic: how to implement or inject Ruby code in a JavaScript environment.
Upvotes: 0
Views: 839
Reputation: 275
There are several projects that aim to do this, but Opal seems to be actively developed. If you can't run Ruby on your target platform or you want a browser app, this is probably the best way to implement a Ruby library in a Node.js environment.
Upvotes: 1
Reputation: 5492
To be clear, Ruby is a backend server-side language and Node.js uses JavaScript as the backend server-side language. Unfortunately, I don't believe you can run Ruby code in a JavaScript environment unless you have some sort of compiler to convert Ruby code to JavaScript code.
Your best bet would be to see if there is an equivalent implementation of that Gem as a NPM module.
Upvotes: -1