From: Piotr Szotkowski Date: 2011-06-16T20:29:36+09:00 Subject: Kernel#autoload vs require_relative --eheScQNz3K90DVRs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I understand that for require to work relative to the given __FILE__=E2=80= =99s 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 =E2=80=93 and if not, should there be one? I=E2=80=99m 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=E2=80=99t 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' =E2=80=94 Piotr Szotkowski --=20 If you watch NASA backwards, it=E2=80=99s about a space agency that has no spaceflight capability, then does low-orbit flights, then lands on moon. [Thomas Fuchs] --eheScQNz3K90DVRs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk356RYACgkQi/mCfdEo8UojMQCgnfS6TNaurFNrPShIxxKTYH1c 7qUAn3G8Qu/FxcFdhHhkiSJ0rhDLQiTg =FtTJ -----END PGP SIGNATURE----- --eheScQNz3K90DVRs--