On Fri, 13 Feb 2004, Yukihiro Matsumoto wrote: > Date: Fri, 13 Feb 2004 01:07:25 +0900 > From: Yukihiro Matsumoto <matz / ruby-lang.org> > Newsgroups: comp.lang.ruby > Subject: Re: ruby-dev summary: 22688-22826 > > Hi, > > In message "Re: ruby-dev summary: 22688-22826" > on 04/02/12, "Ara.T.Howard" <ahoward / fattire.ngdc.noaa.gov> writes: > > |> > * relative > |> > > |> > a keyword/method to transform a path into a relative one > |> > |> The relative keyword needs language change. It's too drastic to this issue. > |> > |> I feel the relative method is too tricky. > | > |how so? wouldn't a simple method to transform a path suffice? > > The point is the word "relative" itself is not specifically related to > file path. > > matz. at least it's better than cousin or uncle! ;-) i see your point... how about 'Kernel.relpath' module Kernel def relpath path, origin = __FILE__ File.join( Pathname.new(File.dirname(File.expand_path(origin))).realpath.to_s, *(File.split(path)) ) end end tho perhaps that should belong in File instead of Kernel it nicer to see require relpath 'foo/bar' than require File.relpath 'foo/bar' maybe both... -a -- (short sig)