On Monday 22 January 2007 06:48 am, Helder Ribeiro wrote:
> Say you write up a method and want to correct it, you have retype or
> find through the history by pressing "Up" all the lines that "worked"
> and re-entering them. You also can't just read them from a file either,
> AFAIK (not smthg like an incomplete method code, for instance).
>
> Conversely, it's not trivial to go through the lines that "worked" in
> that awkward "Up"-key fashion, then select them and save them out to a
> file.
>
> Those are the questions Jonathan Allen pointed out, and I don't have
> good answers for them.
>
> Perhaps there's some different mode in irb where you can quickly
> inspect the aggregated command history as in a regular editor and
> choose to append selected lines out to a file? That'd be very helpful,
> especially with the ability to load them back as if you had typed them
> in yourself, which would allow for loading of incomplete blocks of
> code.
I am not a very experienced Ruby programmer, but what I find helps in that
regard is that I do my irb work in a kde konsole. It displays all the old
lines that I've entered (and results) with its "History" feature. I then
use Linux style copy (select then paste with middle mouse button) to grab the
lines I want, paste them into my editor, and edit out the stuff I don't want
(if I've copied more than I want).
Randy Kramer