ara.t.howard / noaa.gov wrote:
> since the threads split all over the place i figured i'd start yet another.
> can people break this?
well... yes! i ran it, and got:
"a"
a.rb:63:in `override': private method `remove_method' called for C:Class 
(NoMethodError)
         from a.rb:61:in `each'
         from a.rb:61:in `override'
         from a.rb:102

then, once I fixed that:

$ cat b.rb
require 'a'

class C
   c = new

   def M; 'a' end
   def m; 'A' end
   p c.M(), c.m

   override { def M; super + 'b' end; def m; super + 'B' end }
   p c.M(), c.m

   restore 'M'
   p c.M(), c.m

   restore 'm'
   p c.M(), c.m
end

$ ruby b.rb
"a"
"A"
./a.rb:32: warning: already initialized constant M
"Ab"
"AB"
"A"
"AB"
"A"
"A"

This code's a lot longer than the last one you sent, so it's gonna take 
me more time to figure it out.

Devin