From: Devin Mullins Date: 2006-12-12T14:24:21+09:00 Subject: Re: gems cleverness? Giles Bowkett wrote: > Is it the Perl-y $: thing that gives it its magic special sauce? Yup. $: == $LOAD_PATH == the list of directories Ruby looks in when you do a require. FWIW, $" == $LOADED_FEATURES == the list of files (ruby and .so) that have been require'd. > Also, > couldn't the Regexp part work just as well without the Config stuff, > because of the minimal likelihood of a non-gem having that string in > its path? I was just trying to be a little robust. It just expands to /usr/local/lib or c:/prog/ruby/lib or whatever. *Very* unlikely that that path would contain a regex metacharacter that needs escaping, too, but what the hell. Yeah, you certainly could do: $:.map{|s|s=~%r{ruby/gems/1.8/gems/([^/]+)/lib$};$1}.compact.uniq > Actually, wait a minute -- the app also uses ImageMagick, but that > didn't show up here. You might not have triggered the loading of the code that actually depends on it. ActiveSupport overrides const_missing so you need not require everything. (At least, for... I blogsumed that the feature is being deprecated, or at least limited to your own rb files.) Devin