Hi.

I start IRB.

Then I do something like:

> pj

(Input is "pj")

The result is:

NameError: undefined local variable or method `pj' for
#<Object:0xb751d954>
        from (irb):7


Ok, this is what normally happens.

Now I want to hook up a specific class. Let's call it

  class Foo
  end

This class should intercept BEFORE NameError happens. It should then
check that input, like:

  Foo.new(input)
  Foo.new('pj')

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
currently is.

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?

-- 
Posted via http://www.ruby-forum.com/.