From: Dennis Decker Jensen Date: 2001-03-06T05:37:20+09:00 Subject: [ruby-talk:12058] SV: hooking/wrapping all of a classes methods David Alan Black wrote: > Pitfalls? (I sense there might > be some in connection with argument handling, though the few tests > I've done have been OK.) More concise ways? A pitfall in the argument handling. How about this? (not tested) > class Thing > def mone > puts "hi" > end > > def mtwo(a) > puts "bye" > end [...] > # Test > > t = Thing.new > begin > t.mone - t.mtwo # ArgumentError + t.mtwo(12) # Thing#mtwo needs an argument > rescue ArgumentError => msg > puts msg > Thing.new.mtwo(3) # OK > end > > > __END__ Dennis Decker Jensen