jbarnette (owner)

Forks

Revisions

gist: 111542 Download_button fork
public
Public Clone URL: git://gist.github.com/111542.git
Embed All Files: show embed
adjacent.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Require adjacent
# by John Barnette
# to annoy Josh Susser and Aaron Patterson
 
# use to require files relative to the current file:
#
# require adjacent("foo") # require current-dir/lib
# require adjacent("lib", "foo") # joins path segments so you don't have to
 
module Kernel
  def adjacent *things
    File.expand_path File.join(Dir.pwd,
      File.dirname(caller.first.split(":").first), *things)
  end
end