Ok, the title doesn't really say very much, but I couldn't think of anything better.
I'm looking for (J)Ruby library that provides a headless REPL, so to speak. Basically, I want it to take a String, and then tell me if it expects more input, otherwise eval the input so far and give me either the result or an error message.
This is for running a Ruby REPL inside a game, so I'm specifically not looking for irb.
Check out Debugger. It isn't 'live' like a REPL but you can stop code at any given point in your execution and open up irb with the current scope to check/change variables, run methods, etc. Not as fancy as a REPl, but it still may work for your needs.
To install:
Then in your ruby code:
This will open up a prompt that looks like this: