taken from oldrcrs.rubypal.com/rcr/show/309
Dir.getwd
89 90 91 92 93
# File 'lib/sane/sane_random.rb', line 89 def __DIR__ dir = (/^(.+)?:\d+/ =~ caller[0]) ? File.expand_path(File.dirname($1), BASE_DIR) : nil dir += '/' if dir dir end