From: "F. Senault" Date: 2007-07-24T07:00:00+09:00 Subject: Inherited & load Hello. I've written a mechanism to dynamically load plugins inheriting from a base class, using the self.inherited method. Now, in an irb session, I noticed that, even if I (re)load the classes, the self.inherited is only triggered once. Short example : > ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-freebsd6] > cat first.rb #! /usr/local/bin/ruby load "test.rb" load "test.rb" > cat test.rb #! /usr/local/bin/ruby class Test def self.inherited(c) puts "#{c} inherited Test !" end end load "test2.rb" > cat test2.rb #! /usr/local/bin/ruby puts "In #{__FILE__}." class Test2 < Test ; end > ruby first.rb In ./test2.rb. Test2 inherited Test ! In ./test2.rb. Is there a trick somewhere that would allow me to trigger the inherited method at each time the file containing the "sub-class" (e.g. Test2) is loaded ? (The real plugin class, if there is a need, is here : http://www.lacave.net/~fred/projets/plugin.rb ) Fred -- Arithmetic comparisons: greater-than and less-than considered to be judgemental and divisive. In the interests of inclusiveness, only equality-tests will be permitted. (Tanuki in the SDM, on politically-correct coding)