From: Mat Schaffer Date: 2006-07-24T21:38:11+09:00 Subject: Re: Autoloading objects — Ruby equivalent for PHP5 "__autoload On Jul 24, 2006, at 5:58 AM, Naum T. wrote: > Does there exist a Ruby equivalent to PHP5 "magic" __autoload method > that spares the developer from detailing a list of "require" > statements? > http://us2.php.net/autoload > > Or is this something that a homebrewed solution is necessary? Like > catching the exception and testing for file existence, etc.� or is > there > a gem/extension featuring this functionality? const_missing is a little more like PHP's __autoload function. The following, for example will attempt to just do: require 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