[ruby-core:79076] [Ruby trunk Bug#13126] __dir__ in eval returns nil

From: nobu@...
Date: 2017-01-14 07:02:29 UTC
List: ruby-core #79076
Issue #13126 has been updated by Nobuyoshi Nakada.


Artem Shein wrote:
> It should be the same as `File.dirname(__FILE__)` or at least `File.dirname(File.realpath(__FILE__))` (like your documentation say).

When the third argument is not given, `__FILE__` in `eval` is "(eval)".
Do you mean that `__dir__` should be "."?

----------------------------------------
Bug #13126: __dir__ in eval returns nil
https://bugs.ruby-lang.org/issues/13126#change-62484

* Author: Artem Shein
* Status: Feedback
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
~~~
$ ruby -e 'eval "p File.dirname(__FILE__); p __dir__"'
"."
nil
~~~




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next