Created
May 14, 2009 06:45
-
-
Save jbarnette/111542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment