From: "Naum T." Date: 2006-07-25T00:45:26+09:00 Subject: Re: Autoloading objects — Ruby equivalent for? That's seems to be the ticket. Knew about ruby autoload, but you have to specify up front each module/file whereis PHP5, it's (but named "__autoload") a "catch all". One solution is to glob the directory (where I have my classes stored) and issue autoload for each result: # assumes my custom classes begin with upper case Dir.glob('[A-Z]*.rb').each do |f| rsym = f.gsub("[.]rb$", '') autoload(:#{rsym}, f) end > > const_missing is a little more like PHP's __autoload function. > > The following, for example will attempt to just do: require name> in the event it can't find the class. > > def Object.const_missing name > require name.to_s.downcase > const_get(name) > end > > I've never used it though, so anyone can feel free to correct me for > any gotchas that I'm not aware of. > -Mat -- Posted via http://www.ruby-forum.com/.