From: "F. Senault" Date: 2006-08-02T18:50:05+09:00 Subject: Re: Strategies for autoloading ruby files Le 01 ao�t � 23:53, Luke Kanies a �crit : > Is this the best way? Any other recommended mechanisms? I don't know about recommended, but I've made two or three programs using plugins, and here's my method, in the main script : Dir.glob($conf[:path]) do |f| $mtime = File.mtime(f) begin require "#{f}" rescue LoadError => err puts err end end Plugin.plugins.each |p| do ... end class Plugin @@plugins = [] @@mtimes = {} def Grapher.inherited(c) @@plugins.push(c) @@mtimes[c.to_s] = $mtime end def Plugin.plugins @@plugins end def Plugin.mtimes @@mtimes end end And the plugins just have to : class LittlePlugin < Plugin ... end Note : I needed here to know the modification time of the plugin to eventually reinitialize some data. I think that using a global variable is more than clunky. Any thoughts on a better way ? Fred -- The DBAs will be whining because when you kill -9 Oracle, you get bits and pieces left all over the place, and when re-started Oracle gets all squeamish and frightened about what happened to it's predecessor. (Its very literal pre-decessor...) (Dan Holdsworth in the SDM)