From: Ryan Davis Date: 2010-01-31T10:37:25+09:00 Subject: Re: Refining the use of file joins or file expand_path On Jan 30, 2010, at 12:33 , Alpha Blue wrote: > Both bits of code process the same result which is finding .rb file > extensions within a specified relative path. > > The question I have (because I have written used both) is which would > "you" use and why keeping the following in mind.. Neither. I write sane code with sane requires and sane load paths. I also NEVER glob my requires. > Ruby 1.9.x > Cross - OS usability (windows/linux/mac/etc.) > > Dir[File.join(File.dirname(__FILE__),"..","ui","*.rb")].each {|rb_files| > load rb_files} > > Dir[File.expand_path('../../ui/*.rb', __FILE__)].each {|rb_files| load > rb_files} My version: > require "x/ui/blah1" > require "x/ui/blah2" assuming: > lib/x/ui/blah[12].rb It is 100% easier to read, maintain, and understand. There's no magic, and nothing to debug because you don't pull in stuff you didn't expect.