From: David Masover Date: 2011-06-24T04:14:31+09:00 Subject: Re: RFC - One word alias for require_relative On Thursday, June 23, 2011 02:07:47 PM David Masover wrote: > On Wednesday, June 22, 2011 10:25:37 PM Ilias Lazaridis wrote: > > Possibly it would be easier to add behaviour of "require": > > > > require "./filename" #=> loads relative to $Dir.pwd (process working > > directory) > > > > require ":/filename" #=> loads relative to the file-directory > > > > Possibly there's somewhere a standard for this. Reading back, I think my code sample doesn't quite follow your suggestion: > module Kernel > def require_with_colon path > if path =~ /^:(.*)/ Replace that line with if path =~ /^:\/(.*)/ > require_relative $1 > else > require_without_colon path > end > end > alias require_without_colon require > alias require require_with_colon > end That's better, actually, as it means we now only break requiring Ruby files which are in some subdirectory of a directory called ':' which is in the load path, which is sufficiently outlandish that I don't think it's a credible objection anymore. After all, ':' is already the load path separator anyway.