From: "nobu (Nobuyoshi Nakada)" Date: 2013-06-15T08:54:20+09:00 Subject: [ruby-core:55493] [ruby-trunk - Bug #8436] __dir__ not working in eval with binding Issue #8436 has been updated by nobu (Nobuyoshi Nakada). Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED ---------------------------------------- Bug #8436: __dir__ not working in eval with binding https://bugs.ruby-lang.org/issues/8436#change-39939 Author: Gat (Dawid Janczak) Status: Closed Priority: Normal Assignee: Category: Target version: ruby -v: ruby 2.1.0dev (2013-05-22 trunk 40893) [x86_64-linux] Backport: 1.9.3: DONTNEED, 2.0.0: REQUIRED Hello, I think I might have found a bug concerning the new __dir__ method. Given binding (e.g. current top level binding) I would expect __dir__ to return the directory I'm in, similarly to how __FILE__ with binding does. Instead it returns nil. I think I have found the solution, but since this is my first modification of Ruby code it might be inaccurate and not work in some cases. I hope it points to the right location though. Please see attached patch along with a testcase showing the problem. I also had to modify another testcase to use realpath when checking __dir__ functionality, please check if it's correct. -- http://bugs.ruby-lang.org/