Two options:
- write some ruby code, that interfaces with the gem via cli arguments/stdio;
- compile the code to javascript (http://opalrb.org/ or https://github.com/joshnuss/mruby-web-irb, maybe something else).
The second option is crazy and most likely will not work. The first is sane and useable. There are a lot of cases when you have to something like this, especially with java and python libraries. Of course, you can use some other method for IPC like pipes, tcp, 0mq etc, but arguments/stdio is the most simple one.