Hi --
It seems a little odd to me that this:
class C
def self.singleton_method_added(m)
puts "Method #{m} was just defined."
end
end
produces this output:
Method singleton_method_added was just defined.
Wouldn't it be more logical for the callback itself to be excluded
from triggering itself?
David
on 14.08.2008 15:27
on 14.08.2008 16:07
On Thu, Aug 14, 2008 at 3:24 PM, David A. Black <dblack@rubypal.com> wrote: > produces this output: > > Method singleton_method_added was just defined. > > Wouldn't it be more logical for the callback itself to be excluded > from triggering itself? While we're at it: class Class def method_added(m) puts m end end This came up when looking for a full-proof way of catching all method definitions. There is one however that can never be caught, and that's the one above. To that end, it would help a lot if the *old* callback were called instead of the new one. Peter
on 14.08.2008 17:09
On Aug 14, 10:03 am, Calamitas <calamita...@gmail.com> wrote: > definitions. There is one however that can never be caught, and that's > the one above. To that end, it would help a lot if the *old* callback > were called instead of the new one. Not quite the same issue, but closely related... Personally, I would like to see the particular callback completely deactivated while executing. It seems to me that recursing on def method_added(m) define_method("#{m}2"){ } end is not only annoying, but almost certainly unnecessary, since by defining a method within method_added, I already know it's happening. T.