gsamokovarov/web-console — pull request #3 by gsamokovarov (2013-07-01 12:50:38+00:00)
Title: REPL support 

This is the initial outline of the REPL supporting code.

As we can't just use `IRB.start` or `Pry.start`, we want to provide adapters for each REPL, that we'll support. It's job would be to initialize the REPL in an interactive friendly way, e.g. it will allow us to feed it input programmatically.

For now, I plan to rely on duck-typing and not providing a base class for each adapter. The way I see the things now, is that we would need at least two methods for each adapter:

1. `send_input` that should be a function of input text, giving us back output text.
2. `prompt` that will give us the REPL configured prompt.

_(The names are just placeholders.)_

The initialization of the REPL can happen in the adapter constructor, so we can skip the method for that. However, if we are against side effects in constructors, we can extract the initialization into own method as well.

By default, each adapter has to manually register itself into the REPL adapters registry. That can happen after the class is created with a call to `WebConsole::REPL.register_adapter` and the registration will kick in when the adapter is required.