------art_40324_31461549.1156143339463
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Here's a simple IRB session using mine:

$ irb -rqap

Call #start if you want to get a head start on QAPrototype...

irb(main):001:0> start

irb(prep):001:0> @f  oo.new
irb(prep):002:0> @f.bar

For your convenience in testing, I've created a class called
Foo and have already mixed in QAPrototype! Aren't you glad?
And while I was at it, I went ahead and created an instance
of Foo and put it into @f. Now we can all shout for joy!
Heck, we even started up the conversation with method_missing!

bar is undefined.
Please define what I should do, starting with arguments
this method should accept (skip and end with newline):

def bar
  "Hello!"

end

Okay, I got it.


Calling the method now!

"Hello!"
irb(main):002:0> @f.add 10, 12

add is undefined.
Please define what I should do, starting with arguments
this method should accept (skip and end with newline):

def add a, b
  a - b

end

Okay, I got it.


Calling the method now!

-2
irb(main):003:0> @f.undo

add is now gone from this class.

nil
irb(main):004:0> @f.add 10, 12

add is undefined.
Please define what I should do, starting with arguments
this method should accept (skip and end with newline):

def add a, b
  a + b

end

Okay, I got it.


Calling the method now!

22
irb(main):005:0> @f.dump
class Foo
  def bar
    "Hello!"
  end
  def add a, b
    a + b
  end
end
nil
irb(main):006:0> @f.dump "/tmp/foo.rb"

Class was written to /tmp/foo.rb successfully!

nil
irb(main):007:0> exit
$


There you have it. Check out the file attached for my solution.

Of particular note to my solution is an #undo method that will remove
the last method added. As you can tell, it supports arguments.
However, I was not able to fully coax blocks to work properly, at
least on creation (when it calls it after you've created it). That's
negligible, though, and I'll probably iron that out a bit.

Cheers,

M.T.

P.S. - No, I didn't go into another IRB session for those two lines...
I just printed that out to give the general idea of what just happened
to get things rolling.

------art_40324_31461549.1156143339463
Content-Type: text/x-ruby-script; name=qap.rb; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: base64
X-Attachment-Id: f_d6jm4p
Content-Disposition: attachment; filename="qap.rb"

IyBSdWJ5UXVpeiAjOTEgLSBRQVByb3RvdHlwZQoKIyMjIyMjIyMjIyMjIyMjIyMjIyM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