From: Roger Pack Date: 2010-03-24T03:10:56+09:00 Subject: [ruby-core:28898] [Feature #1961] Kernel#__dir__ Issue #1961 has been updated by Roger Pack. My personal preference would be __DIR__ Here's a example patch that seems to work, if it's helpful at all. Index: prelude.rb =================================================================== --- prelude.rb (revision 27020) +++ prelude.rb (working copy) @@ -22,3 +22,12 @@ } end end + +# Kernel + +module Kernel + def __DIR__ + filename = caller[0][/^(.*):/, 1] + File.expand_path(File.dirname(filename)) + end +end (gleaned from an old Ramaze copy). I'd be happy to add tests or change the name or what not, as well, if so directed. Thanks. -rp ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1961 ---------------------------------------- http://redmine.ruby-lang.org