as a side note, in ruby 1.9 caller and several other File-related functions seem to return already-expanded paths; File.expand_path will cause these to end up with an extraneous leading pwd.
ok, dirge looks like a nice pre-existing wheel. But please, someone explain this to me: def ~@ ... end where @ appears to be self ... http://github.com/joshbuddy/dirge/blob/master/lib/dirge.rb On Wed, Dec 23, 2009 at 1:53 PM, Chris Lloyd <[email protected]>wrote: > 2009/12/23 Josh Price <[email protected]> > >> That would be *awesome*. >> > > Here's an early Christmas present. > > module Kernel > alias :plain_require :require > > def require(file) > if file.is_a?(String) > plain_require > File.expand_path(File.join(File.dirname(caller.first.split(':').first), > file)) > else > plain_require file.to_s > end > end > end > > require '../spec_helper' > > Though it's totally unusable because every other library depends on require > searching the load path. Just please don't give it back to me next year. > > Chris > > -- > chrislloyd.com.au > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<rails-oceania%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > -- cheers, David Lee -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
