IRB - Switching "comment mode"

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)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs