IRB - Switching "comment mode"

M

Marc Heiler

Hi,
I've been trying to solve this thing on my TODO list for some time
(ok, it's just on my list, and not of highest priority ;-)), and
finally thought I'd post here.

In IRB, I would like to be able to apply a filter
when something is input to IRB (normally, copy pasted
in my example).
For example, I'd like to filter all lines that start
with a '#', and gsub this with '' so that
comments are evaluated instead.
Right now, when i copy/paste, i remove leading #'s
manually. Right now i'd picture using a little method
that switches between my "comment mode"s.

Now, making such a Regex is trivial. But how could I
apply a filter on IRB? I'd not mind to hack
up my irb but I dont even really figure out how IRB
gets all its things done. (That way I could apply a method
before that input, and depending on a global flag/var,
filter, or not filter that input)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top