https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-01-13T00:34:18ZRuby Issue Tracking SystemRuby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=624792017-01-13T00:34:18Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>Can you show us your expectation? Should what be the value for <code>__dir__</code> inside of an <code>eval</code>?</p> Ruby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=624812017-01-13T15:54:06Zmetadeus (Artem Shein)
<ul></ul><p>Shyouhei Urabe wrote:</p>
<blockquote>
<p>Can you show us your expectation? Should what be the value for <code>__dir__</code> inside of an <code>eval</code>?</p>
</blockquote>
<p>It should be the same as <code>File.dirname(__FILE__)</code> or at least <code>File.dirname(File.realpath(__FILE__))</code> (like your documentation say).</p> Ruby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=624842017-01-14T07:02:29Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Artem Shein wrote:</p>
<blockquote>
<p>It should be the same as <code>File.dirname(__FILE__)</code> or at least <code>File.dirname(File.realpath(__FILE__))</code> (like your documentation say).</p>
</blockquote>
<p>When the third argument is not given, <code>__FILE__</code> in <code>eval</code> is <code>"(eval)"</code>.<br>
Do you mean that <code>__dir__</code> should be <code>"."</code>?</p> Ruby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=624852017-01-14T20:35:25Zmetadeus (Artem Shein)
<ul></ul><p>Nobuyoshi Nakada wrote:</p>
<blockquote>
<p>When the third argument is not given, <code>__FILE__</code> in <code>eval</code> is <code>"(eval)"</code>.<br>
Do you mean that <code>__dir__</code> should be <code>"."</code>?</p>
</blockquote>
<p>No, I mean that documentation is saying:<br>
"The return value equals to <code>File.dirname(File.realpath(__FILE__))</code>." here: <a href="http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-__dir" class="external">http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-__dir</a>__</p>
<p>I've replaced the "<code>File.dirname(File.realpath(__FILE__))</code>" in my source code with "<code>__dir__</code>" and got different result. I don't care about the exact value, but I expect it to be the same.</p> Ruby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=624872017-01-15T00:15:43Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Artem Shein wrote:</p>
<blockquote>
<p>I've replaced the "<code>File.dirname(File.realpath(__FILE__))</code>" in my source code with "<code>__dir__</code>" and got different result. I don't care about the exact value, but I expect it to be the same.</p>
</blockquote>
<p>The former also does not work in <code>eval</code> as expected unless a real path name is given.<br>
Please elaborate on the concrete code.</p> Ruby master - Bug #13126: __dir__ in eval returns nilhttps://bugs.ruby-lang.org/issues/13126?journal_id=800522019-07-25T23:48:16Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li></ul>