Require quirks

i know this has been hashed out, but i seem to have missed the conclusion to
it…

say i have written a class, Klass, which requires some modifications to class
Array and i have the following hierarchy of files

klass/klass.rb
klass/array.rb

and i would like my ‘klass.rb’ file to require ‘array.rb’ without specifying
the entire path and to ensure it does not find some other ‘array.rb’ along the
search path

(i could say require ‘klass/array.rb’ in this case, but i thinking more
generally of this problem)

my solution is to do this in klass.rb

require (File.dirname (FILE) << File::SEPARATOR << ‘array.rb’)

which picks up MY ‘array.rb’ and no other no matter where the package was
installed. does anyone see a problem which this?

-a

···

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

ahoward wrote:

require (File.dirname (FILE) << File::SEPARATOR << ‘array.rb’)

I think someone wrote a require_local that did this. See

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/39830

cool.

guess it’s o.k. then. :wink:

-a

···

On Fri, 21 Feb 2003, Joel VanderWerf wrote:

ahoward wrote:

require (File.dirname (FILE) << File::SEPARATOR << ‘array.rb’)

I think someone wrote a require_local that did this. See

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/39830

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================