I don't believe paths are expanded normally by require, when they include a relative component like "../" at least. In a quick experiment I just whipped up, the following two lines only result in one load: require 'subdir/module' require './subdir/module'
But these two lines result in the file being loaded twice: require 'subdir/module' require 'subdir/../subdir/module' require_relative sounds handy, hope that makes it into MacRuby at some point... -Gabriel On Mon, Dec 20, 2010 at 5:34 AM, Caio Chassot <li...@caiochassot.com> wrote: > On 2010-12-18, at 19:58 , russell muetzelfeldt wrote: > > > > then bar will be included twice since '../bar' does not match > './lib/bar'. what you should do is add the lib directory to $: and then > change the require lines in main.rb to > > I thought $" expanded the paths on its own. I'm stupidly lazy to re-check > that, but I would go as far as saying I'm 90% sure. > > I guess it also doesn't hurt to point out the seldom-heard-of 1.9-ism > require_relative. > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel