From: ara.t.howard@... Date: 2007-04-21T01:19:15+09:00 Subject: Re: require doesn't load non-rb files On Sat, 21 Apr 2007, Volkan Civelek wrote: > well it doesn't have to be so... > any ext other than rb repreduces the problem... > krb, xyz, etc... > but that besides the point, right? not really harp:~ > ri Kernel#require --------------------------------------------------------- Kernel#require require(string) => true or false ------------------------------------------------------------------------ Ruby tries to load the library named _string_, returning +true+ if successful. If the filename does not resolve to an absolute path, it will be searched for in the directories listed in +$:+. If the file has the extension ``.rb'', it is loaded as a source file; if the extension is ``.so'', ``.o'', or ``.dll'', or whatever the default shared library extension is on the current platform, Ruby loads the shared library as a Ruby extension. Otherwise, Ruby tries adding ``.rb'', ``.so'', and so on to the name. The name of the loaded feature is added to the array in +$"+. A feature will not be loaded if it's name already appears in +$"+. However, the file name is not converted to an absolute path, so that ``+require 'a';require './a'+'' will load +a.rb+ twice. require "my-library.rb" require "db-driver" you are seeing require behave exactly as it's doccumented to behave. perhaps you are after the functionality of 'load'?? harp:~ > ri Kernel#load ------------------------------------------------------------ Kernel#load load(filename, wrap=false) => true ------------------------------------------------------------------------ Loads and executes the Ruby program in the file _filename_. If the filename does not resolve to an absolute path, the file is searched for in the library directories listed in +$:+. If the optional _wrap_ parameter is +true+, the loaded script will be executed under an anonymous module, protecting the calling program's global namespace. In no circumstance will any local variables in the loaded file be propagated to the loading environment. -a -- be kind whenever possible... it is always possible. - the dalai lama