On Jun 16, 7:29   
> I understand that for require to work relative to the given __FILE__
> directory one needs to either $LOAD_PATH << File.dirname(__FILE__) or
> use require_relative (with the latter being preferred, I presume).
>
> Is there such an alternative for Kernel#autoload
> and if not, should there be one?
>
> I thinking about lib/foo.rb containing
>
> module Foo
> autoload :Bar, 'foo/bar.rb'
> autoload :Baz, 'foo/baz.rb'
> autoload :Qux, 'foo/qux.rb'
> end
>
> (which doesn work without $LOAD_PATH munging), as
> opposed to the (currently working) lib/foo.rb with
>
> require_relative 'foo/bar.rb'
> require_relative 'foo/baz.rb'
> require_relative 'foo/qux.rb'

The question is, are these libs going to loaded anyway regardless of
what is done with the library? If so than you should just go ahead and
load the libs right away with require_relative. Moreover,
require_relative doesn't have to search though all the load paths, so
it will speed up load times. autoload is only useful for a class or
module that is frequently not used in any given run.