I start IRB.
Then I do something like:
(Input is “pj”)
The result is:
NameError: undefined local variable or method `pj’ for
Ok, this is what normally happens.
Now I want to hook up a specific class. Let’s call it
This class should intercept BEFORE NameError happens. It should then
check that input, like:
And it will decide against an internal list:
When the input was found in the internal list, an action is done,
and no error is reported.
When the input was NOT found, a NameError is triggered just as it
In other words, I need the ability to hook up a specific class before
NameError happens in IRB.
Does anyone have an idea how to do that?