Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112020-06-22T16:27:22ZRuby Issue Tracking System
Redmine Ruby master - Bug #16976 (Closed): Documentation bug in Prochttps://redmine.ruby-lang.org/issues/169762020-06-22T16:27:22Zkwerle (Kurt Werle)kurt@CircleW.org
<p><a href="https://ruby-doc.org/core-2.7.0/Proc.html" class="external">https://ruby-doc.org/core-2.7.0/Proc.html</a></p>
<p>About 1/3 of the way through the docs, it states:</p>
<p>Lambda semantics is typically preserved during the proc lifetime, including &-deconstruction to a block of code:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="o">=</span> <span class="nb">proc</span> <span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">|</span> <span class="n">x</span> <span class="p">}</span>
<span class="n">l</span> <span class="o">=</span> <span class="nb">lambda</span> <span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="o">|</span> <span class="n">x</span> <span class="p">}</span>
<span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]].</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="nb">p</span><span class="p">)</span> <span class="c1">#=> [1, 2]</span>
<span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]].</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="n">l</span><span class="p">)</span> <span class="c1"># ArgumentError: wrong number of arguments (given 1, expected 2)</span>
</code></pre>
<p>The 3rd line of code should be:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]].</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="nb">p</span><span class="p">)</span> <span class="c1">#=> [1, 3]</span>
</code></pre> Ruby master - Feature #16971 (Open): weak_ref&.some_method should behave like object&.some_methodhttps://redmine.ruby-lang.org/issues/169712020-06-19T15:07:55Zkwerle (Kurt Werle)kurt@CircleW.org
<p>The following patterns mean basically the same thing and should behave the same:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">weak_ref</span> <span class="o">=</span> <span class="no">WeakRef</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">some_object</span><span class="p">)</span>
<span class="o">...</span>
<span class="n">weak_ref</span><span class="p">.</span><span class="nf">some_method</span> <span class="k">if</span> <span class="n">weak_ref</span><span class="p">.</span><span class="nf">weakref_alive?</span><span class="p">()</span>
<span class="n">some_object</span><span class="p">.</span><span class="nf">some_method</span> <span class="k">if</span> <span class="n">some_object</span><span class="p">.</span><span class="nf">present?</span>
</code></pre>
<p>The some_object predicate got cleaned up by using &.some_method. It would be super clean if WeakRef did the same.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">weak_ref</span> <span class="o">=</span> <span class="no">WeakRef</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">some_object</span><span class="p">)</span>
<span class="o">...</span>
<span class="n">weak_ref</span><span class="o">&</span><span class="p">.</span><span class="nf">some_method</span> <span class="c1"># should not raise WeakRef::RefError</span>
</code></pre> Backport21 - Backport #9305 (Closed): BigDecimal inconsistent between 2.0, 2.1 (probably incorrec...https://redmine.ruby-lang.org/issues/93052013-12-27T06:57:32Zkwerle (Kurt Werle)kurt@CircleW.org
<p>BigDecimal / BigDecimal seems to round off.</p>
<p>The test case has not been reduced to trivial, but it's pretty small and should be pretty clear.</p>
<p>ruby bigdecimal_spec.rb<br>
passes for ruby 2.0.</p>
<p>Fails for ruby 2.1</p>
<p>ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]</p> Ruby master - Bug #2423 (Rejected): REXML edge case with <a>A > B</a>https://redmine.ruby-lang.org/issues/24232009-12-03T10:48:01Zkwerle (Kurt Werle)kurt@CircleW.org
<p>=begin<br>
The attached file: rexml_test.rb was written in the context of a rails app, and used ./script/runner to execute.</p>
<p>It uses Nokogiri by way of comparison to REXML.</p>
<h1>There are 4 test cases, and only the last one fails: REXML trying to parse the contents of A > B<br>
It turns out, surprisingly, that the line is required for this to fail - without it, all tests will work.</h1>
<p>% gem list nokogiri</p>
<p>*** LOCAL GEMS ***</p>
<a name="nokogiri-140-133-132-123-110-107"></a>
<h1 >nokogiri (1.4.0, 1.3.3, 1.3.2, 1.2.3, 1.1.0, 1.0.7)<a href="#nokogiri-140-133-132-123-110-107" class="wiki-anchor">¶</a></h1>
<p>My output (Mac OS X, Leopard):<br>
% ./script/runner rexml_test.rb<br>
.../monkeypatches.rb:13: warning: already initialized constant RAILS_DEFAULT_LOGGER<br>
HI. You're using libxml2 version 2.6.16 which is over 4 years old and has<br>
plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you<br>
upgrade your version of libxml2 and re-install nokogiri. If you like using<br>
libxml2 version 2.6.16, but don't like this warning, please define the constant<br>
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.</p>
<p>/Users/lkwerle/.gem/ruby/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/builder.rb:272: warning: parenthesize argument(s) for future version<br>
noko_value: A bigger than B<br>
return_string: A bigger than B<br>
noko_value: A > B<br>
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/entity.rb:76:in <code>unnormalized': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.record_entity_expansion from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/doctype.rb:139:in </code>entity'<br>
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:325:in <code>unnormalize' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:323:in </code>each'<br>
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:323:in <code>unnormalize' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/text.rb:174:in </code>value'<br>
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rexml/element.rb:452:in <code>text' from rexml_test.rb:32 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in </code>eval'<br>
from /.../vendor/rails/railties/lib/commands/runner.rb:46<br>
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in <code>gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in </code>require'<br>
from ./script/runner:3<br>
=end</p>