Skip to content

Instantly share code, notes, and snippets.

@jbarnette
Created May 14, 2009 06:45
Show Gist options
  • Save jbarnette/111542 to your computer and use it in GitHub Desktop.
Save jbarnette/111542 to your computer and use it in GitHub Desktop.
# 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