Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-04-21T19:24:01ZRuby Issue Tracking System
Redmine Ruby master - Bug #13493 (Closed): `make realclean` removes aclocal.m4 and enc/jis/props.hhttps://bugs.ruby-lang.org/issues/134932017-04-21T19:24:01Zstomar (Marcus Stollsteimer)
<p><code>make realclean</code> removes aclocal.m4 and enc/jis/props.h, which both are under version control, and probably should be kept(?).</p> Ruby master - Bug #13492 (Closed): Integer#prime? and Prime.each might produce false positiveshttps://bugs.ruby-lang.org/issues/134922017-04-21T19:06:31Zstomar (Marcus Stollsteimer)
<p>There is a bug in Integer#prime? that might result in the method returning <code>true</code> for (very big) numbers that are not prime. Similarly, Prime.each might yield numbers that are not prime.</p>
<p>Integer#prime? uses <code>Math.sqrt(self).to_i</code> to determine the upper limit up to which trial divisions are carried out. However, Math.sqrt uses floating point arithmetic, which might lead to considerable differences between its result and the correct integer sqrt.</p>
<p>In the case where Math.sqrt returns a number that is too low, the trial division aborts too early and might miss a higher prime factor. Therefore, a non-prime number might erroneously reported to be prime.</p>
<p>Note that this bug probably has very low impact for practical use cases. The affected numbers are very big, probably well beyond the range where calculating Integer#prime? in a reasonable amount of time is feasible. For double precision floats, Math.sqrt().to_i should produce wrong results for integers from around <code>10**30</code> or <code>10**31</code> upwards.</p>
<p>Example:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="o">=</span> <span class="mi">150094635296999111</span> <span class="c1"># a prime number</span>
<span class="n">n</span> <span class="o">=</span> <span class="nb">p</span> <span class="o">*</span> <span class="nb">p</span> <span class="c1"># not prime</span>
<span class="n">n</span> <span class="c1"># => 22528399544939171409947441934790321</span>
</code></pre>
<p>n is not a prime number and has only one prime factor, namely p. n can only be identified correctly as non-prime when a trial division with p is carried out.</p>
<p>However, Integer#prime? stops testing before p is reached:</p>
<pre><code>Math.sqrt(n).to_i # => 150094635296999104 (!)
p # => 150094635296999111
</code></pre>
<p>It would therefore erroneously return <code>true</code> (after a very long time of waiting for the result).</p>
<p>(To be precise: the method tests in batches of 30, and the highest tested number in this case would actually be 150094635296999101; the remaining numbers up to the (wrong) limit are known to be multiples of 2 or 3, and need not be tested.)</p>
<p>Prime.each has the same problem. It uses Prime::EratosthenesGenerator by default, which calculates the upper limit with Math.sqrt().floor (via Prime::EratosthenesSieve).</p>
<p>For trunk, this bug can easily be fixed by using the (new) Integer.sqrt method, see attached patch.</p>
<p>I'm not sure whether a patch for Ruby 2.4 and 2.3 (where Integer.sqrt is not available) is necessary.</p> Ruby master - Bug #13487 (Closed): Update ri man page (and others)https://bugs.ruby-lang.org/issues/134872017-04-20T10:12:07Zstomar (Marcus Stollsteimer)
<p>Backport ticket.</p> Ruby master - Bug #13440 (Closed): Integer.sqrt produces wrong resultshttps://bugs.ruby-lang.org/issues/134402017-04-15T13:19:55Zstomar (Marcus Stollsteimer)
<p>The new <code>Integer.sqrt</code> method produces wrong results, e.g. for</p>
<pre><code>38815036599065022652481536
38904514499428047971680256
</code></pre>
<p>and (many) other numbers.</p>
<p>Note that these numbers were picked selectively (these are not the 2 smallest examples), and also that they are well in the range where Math.sqrt(n).to_i still gives correct results (Float precision still sufficient). However, the latter point is only incidental, I also found much bigger examples, in the range where Math.sqrt is useless.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">numbers</span> <span class="o">=</span> <span class="p">[</span>
<span class="mi">38815036599065022652481534</span><span class="p">,</span>
<span class="mi">38815036599065022652481535</span><span class="p">,</span>
<span class="mi">38815036599065022652481536</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">38815036599065022652481537</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">38904514499428047971680254</span><span class="p">,</span>
<span class="mi">38904514499428047971680255</span><span class="p">,</span>
<span class="mi">38904514499428047971680256</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">38904514499428047971680257</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">40271703432545948091285502</span><span class="p">,</span>
<span class="mi">40271703432545948091285503</span><span class="p">,</span>
<span class="mi">40271703432545948091285504</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">40271703432545948091285505</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="mi">1442115351524865087017488818362939538217338142719</span><span class="p">,</span>
<span class="mi">1442115351524865087017488818362939538217338142720</span><span class="p">,</span> <span class="c1"># fails</span>
<span class="p">]</span>
<span class="k">def</span> <span class="nf">validate</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="n">root</span><span class="p">)</span>
<span class="n">root</span><span class="o">**</span><span class="mi">2</span> <span class="o"><=</span> <span class="n">number</span> <span class="o">&&</span> <span class="p">(</span><span class="n">root</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">></span> <span class="n">number</span>
<span class="k">end</span>
<span class="n">numbers</span><span class="p">.</span><span class="nf">map</span> <span class="p">{</span><span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="p">[</span><span class="no">Integer</span><span class="p">.</span><span class="nf">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">),</span> <span class="n">validate</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="no">Integer</span><span class="p">.</span><span class="nf">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">))]</span> <span class="p">}</span>
<span class="c1"># => [[6230171474290, true],</span>
<span class="c1"># [6230171474290, true],</span>
<span class="c1"># [6230171582464, false],</span>
<span class="c1"># [6230171582464, false],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6237348429824, false],</span>
<span class="c1"># [6237348429824, false],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [6345999122432, false],</span>
<span class="c1"># [6345999122432, false],</span>
<span class="c1"># [1200881073014669961418100, true],</span>
<span class="c1"># [1200881075629054276665344, false]]</span>
<span class="n">numbers</span><span class="p">.</span><span class="nf">map</span> <span class="p">{</span><span class="o">|</span><span class="n">n</span><span class="o">|</span> <span class="p">[</span><span class="no">Math</span><span class="p">.</span><span class="nf">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">).</span><span class="nf">to_i</span><span class="p">,</span> <span class="n">validate</span><span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="no">Math</span><span class="p">.</span><span class="nf">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">).</span><span class="nf">to_i</span><span class="p">)]</span> <span class="p">}</span>
<span class="c1"># => [[6230171474290, true],</span>
<span class="c1"># [6230171474290, true],</span>
<span class="c1"># [6230171474290, true],</span>
<span class="c1"># [6230171474290, true],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6237348354824, true],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [6345999009812, true],</span>
<span class="c1"># [1200881073014669968408576, false],</span>
<span class="c1"># [1200881073014669968408576, false]]</span>
<span class="mi">1</span><span class="p">.</span><span class="nf">size</span> <span class="c1"># => 4 (32-bit system)</span>
</code></pre>
<p>Interestingly, I found only examples (yet) where <code>Integer.sqrt</code> produces results that are (much) too big.</p>
<p>It was rather too easy to find those; here's what I did:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">too_big</span><span class="p">,</span> <span class="n">too_small</span> <span class="o">=</span> <span class="p">[],</span> <span class="p">[]</span>
<span class="n">total</span> <span class="o">=</span> <span class="mi">0</span>
<span class="mi">0</span><span class="p">.</span><span class="nf">step</span><span class="p">(</span><span class="ss">to: </span><span class="mi">50</span><span class="p">,</span> <span class="ss">by: </span><span class="mf">0.001</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="n">n</span> <span class="o">=</span> <span class="p">(</span><span class="mi">10</span><span class="o">**</span><span class="n">i</span><span class="p">).</span><span class="nf">to_i</span>
<span class="k">raise</span> <span class="k">unless</span> <span class="n">n</span><span class="p">.</span><span class="nf">class</span> <span class="o">==</span> <span class="no">Integer</span> <span class="c1"># just to make sure...</span>
<span class="n">int_root</span> <span class="o">=</span> <span class="no">Integer</span><span class="p">.</span><span class="nf">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">)</span>
<span class="n">total</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="n">too_big</span> <span class="o"><<</span> <span class="n">n</span> <span class="k">if</span> <span class="n">int_root</span><span class="o">*</span><span class="n">int_root</span> <span class="o">></span> <span class="n">n</span>
<span class="n">too_small</span> <span class="o"><<</span> <span class="n">n</span> <span class="k">if</span> <span class="p">(</span><span class="n">int_root</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">int_root</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o"><=</span> <span class="n">n</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s2">"total: </span><span class="si">#{</span><span class="n">total</span><span class="si">}</span><span class="s2">"</span>
<span class="nb">puts</span>
<span class="nb">puts</span> <span class="s2">"too small (</span><span class="si">#{</span><span class="n">too_small</span><span class="p">.</span><span class="nf">size</span><span class="si">}</span><span class="s2">):"</span><span class="p">,</span> <span class="n">too_small</span>
<span class="nb">puts</span>
<span class="nb">puts</span> <span class="s2">"too big (</span><span class="si">#{</span><span class="n">too_big</span><span class="p">.</span><span class="nf">size</span><span class="si">}</span><span class="s2">):"</span>
<span class="nb">puts</span> <span class="n">too_big</span><span class="p">[</span><span class="mi">0</span><span class="o">..</span><span class="mi">9</span><span class="p">]</span>
<span class="nb">puts</span> <span class="s2">"..."</span>
<span class="nb">puts</span> <span class="n">too_big</span><span class="p">[</span><span class="o">-</span><span class="mi">10</span><span class="o">..-</span><span class="mi">1</span><span class="p">]</span>
<span class="c1"># >> total: 50001</span>
<span class="c1"># >> </span>
<span class="c1"># >> too small (0):</span>
<span class="c1"># >> </span>
<span class="c1"># >> too big (3579):</span>
<span class="c1"># >> 38815036599065022652481536</span>
<span class="c1"># >> 38904514499428047971680256</span>
<span class="c1"># >> 38994198667654436652843008</span>
<span class="c1"># >> 39810717055349854497144832</span>
<span class="c1"># >> 40271703432545948091285504</span>
<span class="c1"># >> 40364539296760648765014016</span>
<span class="c1"># >> 40457589169744204087164928</span>
<span class="c1"># >> 40644332916521443952427008</span>
<span class="c1"># >> 40926065973001261821198336</span>
<span class="c1"># >> 42169650342858222399913984</span>
<span class="c1"># >> ...</span>
<span class="c1"># >> 1324341535194664238462783233069825155347351863296</span>
<span class="c1"># >> 1367728825595857894544027656111101204949201059840</span>
<span class="c1"># >> 1370881766164855075247880701478883966489888555008</span>
<span class="c1"># >> 1409288798421877644341184857286932334307738386432</span>
<span class="c1"># >> 1412537544622749693814622477014802231398687047680</span>
<span class="c1"># >> 1415793779957092451680042925874609046246970621952</span>
<span class="c1"># >> 1422328787122815537257372883177955123216529752064</span>
<span class="c1"># >> 1432187899273539462185319204962288499459270639616</span>
<span class="c1"># >> 1438798578255849634982033297755877609401625870336</span>
<span class="c1"># >> 1442115351524865087017488818362939538217338142720</span>
</code></pre> Ruby master - Bug #13422 (Closed): etc.gemspec is invalid (typo)https://bugs.ruby-lang.org/issues/134222017-04-11T12:09:22Zstomar (Marcus Stollsteimer)
<p>The gemspec for etc is invalid (and lets <code>rvm install ruby-head</code> fail):</p>
<pre><code class="diff syntaxhl" data-language="diff"><span class="gh">diff --git a/ext/etc/etc.gemspec b/ext/etc/etc.gemspec
index fd81ec3..f961b67 100644
</span><span class="gd">--- a/ext/etc/etc.gemspec
</span><span class="gi">+++ b/ext/etc/etc.gemspec
</span><span class="p">@@ -3,7 +3,7 @@</span>
Gem::Specification.new do |spec|
spec.name = "etc"
spec.version = "0.2.1"
<span class="gd">- soec.date = '2017-02-27'
</span><span class="gi">+ spec.date = '2017-02-27'
</span> spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"]
</code></pre>
<p>I wanted to open an issue on GitHub, but the affected line doesn't exist in the gemspec there.</p>
<p>On a side note: will <code>spec.files</code> with <code>git ls-files ...</code> work in all installation scenarios?</p> Ruby master - Feature #13420 (Closed): Integer#{round,floor,ceil,truncate} should always return a...https://bugs.ruby-lang.org/issues/134202017-04-10T18:39:18Zstomar (Marcus Stollsteimer)
<p>The current behavior of Integer#{round,floor,ceil,truncate} produces wrong results for large integers.</p>
<p>In the case of a positive precision argument, these methods return the receiver converted to a float, effectively doing the same as <code>to_f</code>.</p>
<pre><code>2.round(1) # => 2.0
</code></pre>
<p>This leads to errors for large integers:</p>
<pre><code>(10**25).round(2).to_i # => 10000000000000000905969664
(10**400).round(2) # => Infinity
</code></pre>
<p>Mathematically speaking, the value of an integer should not be changed by #round, #floor, #ceil, or #truncate, regardless of the precision (when positive). An integer rounded to e.g. 2 decimal digits is still the same (and exact) integer.</p>
<p>The desired behavior should be to keep precision as high as possible by not needlessly converting to Float.</p>
<p>The provided patch fixes these methods to return <code>self</code> for positive precision argument, similar to the behavior without a specified precision, i.e. precision 0.</p> Ruby master - Bug #13414 (Closed): Backport various revisions (documentation related)https://bugs.ruby-lang.org/issues/134142017-04-09T15:43:53Zstomar (Marcus Stollsteimer)
<p>Here is a list of recent revisions that have no related ticket.<br>
They are all doc fixes or improvements, some are only minor fixes and some are bigger edits.</p>
<p>I couldn't find out from the Wiki which kind of doc fixes are supposed to get backported and which aren't, but I noticed that usually all revisions related to some ticket <em>are</em> backported, even small fixes, so I would assume that in principle all improvements are supposed to get backported(?).</p>
<p>Please tell me if backporting is not necessary or not desired, or if this way of requesting it is not the right one (if for example this should be split into smaller chunks or even individual requests).</p>
<ul>
<li>r57744 lib/mathn.rb: nodoc internal Math.rsqrt</li>
<li>r57751 lib/fileutils.rb: improve rdoc for FileUtils</li>
<li>r57755 struct.c: improve rdoc for Struct</li>
<li>r57770,r57771 array.c,enum.c: documentation for sort methods</li>
<li>r57777 lib/unicode_normalize.rb: rdoc for String class</li>
<li>r57778 string.c: fix doc formatting for String#==, #===</li>
<li>r57781,r57790 io.c: docs for IO.{write,read} and other improvements</li>
<li>r57823 object.c: simplify Object#tap example</li>
<li>r57886,r57963 string.c: docs for {String,Symbol}#{casecmp,casecmp?}</li>
<li>r57992 bignum.c: typos and grammar</li>
<li>r58008 io.c: improve docs</li>
<li>r58215 doc/syntax/methods.rdoc: small improvements</li>
<li>r58230 rational.c: improve docs</li>
<li>only 2.4: r58190,r58192,r58235,r58242,r58244 numeric.c,rational.c: improve docs for #round, #truncate, #floor, #ceil</li>
<li>r58290,r58291 numeric.c,math.c: improve docs for Float and Math.sqrt</li>
<li>r58329,r58331 lib/unicode_normalize{/,.rb}: nodoc UnicodeNormalize; improve docs</li>
</ul> Ruby master - Bug #13312 (Closed): String#casecmp raises TypeError instead of returning nilhttps://bugs.ruby-lang.org/issues/133122017-03-13T20:48:24Zstomar (Marcus Stollsteimer)
<p>String#casecmp and String#casecmp? behave differently from other comparison methods: for incomparable values they raise a TypeError, while Symbol#{casecmp,casecmp?} and the #<=> methods (also for other classes) return <code>nil</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="s2">"abc"</span> <span class="o"><=></span> <span class="mi">1</span> <span class="c1"># => nil</span>
<span class="s2">"abc"</span><span class="p">.</span><span class="nf">casecmp</span> <span class="mi">1</span> <span class="c1"># TypeError: no implicit conversion of Integer into String</span>
<span class="s2">"abc"</span><span class="p">.</span><span class="nf">casecmp?</span> <span class="mi">1</span> <span class="c1"># TypeError: no implicit conversion of Integer into String</span>
<span class="ss">:abc</span> <span class="o"><=></span> <span class="mi">1</span> <span class="c1"># => nil</span>
<span class="ss">:abc</span><span class="p">.</span><span class="nf">casecmp</span> <span class="mi">1</span> <span class="c1"># => nil</span>
<span class="ss">:abc</span><span class="p">.</span><span class="nf">casecmp?</span> <span class="mi">1</span> <span class="c1"># => nil</span>
<span class="mi">1</span> <span class="o"><=></span> <span class="no">Time</span><span class="p">.</span><span class="nf">now</span> <span class="c1"># => nil</span>
<span class="p">[]</span> <span class="o"><=></span> <span class="ss">:foo</span> <span class="c1"># => nil</span>
</code></pre>
<p>This is surprising, since String#casecmp is essentially a case-insensitive version of String#<=>, which seems to imply that they should behave in a similar way. Also, the different behavior for String and Symbol might be an indication that this is a bug and not intentional.</p> Ruby master - Bug #13306 (Closed): [DOC] rdoc for IO#putshttps://bugs.ruby-lang.org/issues/133062017-03-12T20:42:46Zstomar (Marcus Stollsteimer)
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/5">@naruse (Yui NARUSE)</a></p>
<p>This would effectively revert your recent r57944, so please give ok for me to apply this patch.</p>
<p>I don't think the mention of IO#write (or IO#print) is necessary (implementation detail); instead I expanded the docs with some information copied from write/print, like e.g. mention of <code>to_s</code>.</p>
<p>And I do not understand at all how puts should have an effect on the input record separator, or why someone would assume it might have.</p>
<pre><code class="diff syntaxhl" data-language="diff"><span class="gh">diff --git a/io.c b/io.c
index f1cdc56..e727d0a 100644
</span><span class="gd">--- a/io.c
</span><span class="gi">+++ b/io.c
</span><span class="p">@@ -7181,15 +7181,17 @@</span> io_puts_ary(VALUE ary, VALUE out, int recur)
* call-seq:
* ios.puts(obj, ...) -> nil
*
<span class="gd">- * Writes the given object(s) to <em>ios</em> as with <code>IO#write</code>.
</span><span class="gi">+ * Writes the given object(s) to <em>ios</em>.
</span> * Writes a newline after any that do not already end
<span class="gd">- * with a newline sequence.
</span><span class="gi">+ * with a newline sequence. Returns +nil+.
</span> *
<span class="gi">+ * The stream must be opened for writing.
</span> * If called with an array argument, writes each element on a new line.
<span class="gi">+ * Each given object that isn't a string or array will be converted
+ * by calling its <code>to_s</code> method.
</span> * If called without arguments, outputs a single newline.
<span class="gd">- * This doesn't affect $/. ($RS or INPUT_RECORD_SEPARATOR in English.rb)
</span> *
<span class="gd">- * $stdout.puts("this", "is", "a", "test")
</span><span class="gi">+ * $stdout.puts("this", "is", ["a", "test"])
</span> *
* <em>produces:</em>
*
<span class="gd">--
</span><span class="p">1.9.1
</span><span class="err">
</span></code></pre> Ruby master - Bug #13281 (Closed): [DOC] OptionParser docs leak into class documentation of Objecthttps://bugs.ruby-lang.org/issues/132812017-03-04T18:44:11Zstomar (Marcus Stollsteimer)
<p>Since r46126 [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Rename 'optparse' to 'optionparser', or the main class OptionParser to OptParse (Closed)" href="https://bugs.ruby-lang.org/issues/9864">#9864</a>], where OptParse was added as an alias for OptionParser, the complete class documentation for OptionParser leaks into the class documentation for Object.</p>
<p>This affects docs since 2.2:</p>
<ul>
<li><a href="https://docs.ruby-lang.org/en/2.2.0/Object.html#label-Introduction" class="external">https://docs.ruby-lang.org/en/2.2.0/Object.html#label-Introduction</a></li>
<li><a href="https://docs.ruby-lang.org/en/2.3.0/Object.html#label-Introduction" class="external">https://docs.ruby-lang.org/en/2.3.0/Object.html#label-Introduction</a></li>
<li><a href="https://docs.ruby-lang.org/en/2.4.0/Object.html#label-Introduction" class="external">https://docs.ruby-lang.org/en/2.4.0/Object.html#label-Introduction</a></li>
</ul> Ruby master - Bug #13275 (Closed): RDoc bug for "Document-method: []"https://bugs.ruby-lang.org/issues/132752017-03-03T11:59:09Zstomar (Marcus Stollsteimer)
<p>RDoc doesn't handle Document-method directives for <code>#[]</code> correctly. When multiple directives are given, "Document-method: []" shows up as a code block, at the beginning of the docs for the method of the directive before:</p>
<pre><code>$ cat document-method-test.c
/*
* Document-method: foo
* Document-method: []
* Document-method: bar
*
* Does nothing.
*/
static VALUE
rb_my_method(void)
{
}
rb_cFoo = rb_define_class("Foo", rb_cObject);
rb_define_method(rb_cFoo, "foo", rb_my_method, 0);
rb_define_method(rb_cFoo, "bar", rb_my_method, 0);
rb_define_method(rb_cFoo, "[]", rb_my_method, 0);
</code></pre>
<p>The directive affects the docs for <code>#foo</code>:</p>
<pre><code>$ rdoc --ri document-method-test.c -o mydoc
$ ri Foo.foo -d mydoc
Foo.foo
(from /.../.../mydoc)
------------------------------------------------------------------------------
foo()
------------------------------------------------------------------------------
Document-method: []
Does nothing.
</code></pre>
<p>When the order of the Document-method directives is changed, with <code>Document-method: []</code> as the first one, everything is rendered correctly.</p>
<p>Real life example: <a href="https://docs.ruby-lang.org/en/2.3.0/Proc.html#method-i-call" class="external">https://docs.ruby-lang.org/en/2.3.0/Proc.html#method-i-call</a></p> Ruby master - Bug #13273 (Closed): [DOC] Proc#call docs show "Document-method: []" directivehttps://bugs.ruby-lang.org/issues/132732017-03-03T08:32:25Zstomar (Marcus Stollsteimer)
<p>The documentation for Proc#call displays one of its Document-method directives as a code block:</p>
<pre><code>$ ri Proc.call
------------------------------------------------------------------------------
prc.call(params,...) -> obj
------------------------------------------------------------------------------
Document-method: []
Invokes the block, ...
</code></pre>
<p>See also <a href="https://docs.ruby-lang.org/en/2.3.0/Proc.html#method-i-call" class="external">https://docs.ruby-lang.org/en/2.3.0/Proc.html#method-i-call</a>.</p> Ruby master - Bug #13268 (Closed): [DOC] Restore docs for String#<<https://bugs.ruby-lang.org/issues/132682017-03-02T10:23:12Zstomar (Marcus Stollsteimer)
<p>Since r56021 (Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: `String#concat`, `Array#concat`, `String#prepend` to take multiple arguments (Closed)" href="https://bugs.ruby-lang.org/issues/12333">#12333</a>), <code>String#<<</code> is not documented; the patch fixes this.</p>
<p>A backport should only be needed for 2.4.</p> Ruby master - Bug #13262 (Closed): Docs of core classes (Math and others) are shadowed by mathn.r...https://bugs.ruby-lang.org/issues/132622017-02-28T10:26:26Zstomar (Marcus Stollsteimer)
<p>The deprecated (<a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: It might be better to make Mathn class deprecated (Closed)" href="https://bugs.ruby-lang.org/issues/10169">#10169</a>) mathn library leaks documentation into some core classes, or even replaces it (see example further down).</p>
<p>I would like to fix this, but I could need some ideas what would be the best way to do that. The problem is that mathn is not a module/class which could have it's own docs, but only modifies core classes.</p>
<p>Should I:</p>
<ul>
<li>simply comment out the rdoc?</li>
<li>add sections/paragraphs directly to the affected core classes, at the appropriate place?</li>
<li>can <code>ri mathn</code> be made to work somehow (documentation for a source file)?</li>
<li>...?</li>
</ul>
<p>Example: Math.sqrt</p>
<pre><code>$ ri Math::sqrt
(from ruby site)
------------------------------------------------------------------------------
sqrt(a)
------------------------------------------------------------------------------
Computes the square root of a. It makes use of Complex and Rational to
have no rounding errors if possible.
Math.sqrt(4/9) # => 2/3
Math.sqrt(- 4/9) # => Complex(0, 2/3)
Math.sqrt(4.0/9.0) # => 0.666666666666667
</code></pre>
<p>That's <strong>not</strong> the standard behavior of Math.sqrt and neither the documentation that is provided in <code>math.c</code>; these are the docs provided in <code>lib/mathn.rb</code>, corresponding to the behavior after <code>require "mathn"</code>.</p>
<p>Also affected:</p>
<ul>
<li>class documentation of Integer (mathn docs are added at some unspecified place <em>before</em> the proper docs, <a href="https://docs.ruby-lang.org/en/trunk/Integer.html" class="external">https://docs.ruby-lang.org/en/trunk/Integer.html</a>)</li>
<li>ditto for Math (<a href="https://docs.ruby-lang.org/en/trunk/Math.html" class="external">https://docs.ruby-lang.org/en/trunk/Math.html</a>)</li>
<li>ditto for Object (shows the general description of mathn: <a href="https://docs.ruby-lang.org/en/trunk/Object.html#method-i-unknown-label-mathn" class="external">https://docs.ruby-lang.org/en/trunk/Object.html#method-i-unknown-label-mathn</a>)</li>
<li>
<del>internal <code>Math.rsqrt</code> method documented publicly</del> (r57744)</li>
</ul> Ruby master - Bug #13251 (Closed): [DOC] Add rdoc for Integer.sqrthttps://bugs.ruby-lang.org/issues/132512017-02-24T23:52:58Zstomar (Marcus Stollsteimer)
<p>Nobu, I would offer to add documentation for Integer.sqrt, feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: bug in Math.sqrt(n).to_i, to compute integer squareroot, new word to accurately fix it (Closed)" href="https://bugs.ruby-lang.org/issues/13219">#13219</a> (r57705).</p>
<p>I'd like to prepare a patch and eventually try to commit it myself.</p>
<p>I'm not sure yet when to open issues for documentation and when to simply commit; I would be glad about any feedback.</p> Ruby master - Bug #13237 (Closed): Behavior for #dup and #clone on Rational/Complex/BigDecimal di...https://bugs.ruby-lang.org/issues/132372017-02-20T20:52:45Zstomar (Marcus Stollsteimer)
<p>Since the implementation of feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Avoid exception for #dup on Integer (and similar cases) (Closed)" href="https://bugs.ruby-lang.org/issues/12979">#12979</a>, #dup and #clone on Integer and Float do not raise a <code>TypeError</code> anymore, and silently return self. Rational and Complex still raise an exception.</p>
<p>I'm not sure whether this inconsistent behavior is intended or only an oversight. I guess all Numeric classes should behave in a similar way?</p>
<p>Additionally, what is the intention regarding the returned object for non-immediate numeric values, should they return self or a new object?<br>
At the time being, BigDecimal (which already did allow #dup/#clone before the change) returns a new object, while Bignum integers return self.</p>
<p>Current behavior:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">RUBY_VERSION</span> <span class="c1"># => "2.4.0"</span>
<span class="mi">1</span><span class="p">.</span><span class="nf">dup</span> <span class="c1"># => 1</span>
<span class="mi">1</span><span class="p">.</span><span class="nf">clone</span> <span class="c1"># => 1</span>
<span class="mf">1.5</span><span class="p">.</span><span class="nf">dup</span> <span class="c1"># => 1.5</span>
<span class="mf">1.5</span><span class="p">.</span><span class="nf">clone</span> <span class="c1"># => 1.5</span>
<span class="no">Rational</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Rational></span>
<span class="no">Rational</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Rational></span>
<span class="no">Complex</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Complex></span>
<span class="no">Complex</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Complex></span>
<span class="nb">require</span> <span class="s2">"bigdecimal"</span>
<span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="c1"># => 0.1e1</span>
<span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="c1"># => 0.1e1</span>
<span class="n">d</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o"><<</span><span class="mi">64</span><span class="p">)</span>
<span class="p">[</span><span class="n">d</span><span class="p">.</span><span class="nf">object_id</span><span class="p">,</span> <span class="n">d</span><span class="p">.</span><span class="nf">dup</span><span class="p">.</span><span class="nf">object_id</span><span class="p">,</span> <span class="n">d</span><span class="p">.</span><span class="nf">clone</span><span class="p">.</span><span class="nf">object_id</span><span class="p">]</span> <span class="c1"># => [5134140, 5134140, 5134140]</span>
<span class="n">d</span> <span class="o">=</span> <span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="p">[</span><span class="n">d</span><span class="p">.</span><span class="nf">object_id</span><span class="p">,</span> <span class="n">d</span><span class="p">.</span><span class="nf">dup</span><span class="p">.</span><span class="nf">object_id</span><span class="p">,</span> <span class="n">d</span><span class="p">.</span><span class="nf">clone</span><span class="p">.</span><span class="nf">object_id</span><span class="p">]</span> <span class="c1"># => [5133040, 5132900, 5132840]</span>
</code></pre>
<p>Old behavior:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">RUBY_VERSION</span> <span class="c1"># => "2.3.3"</span>
<span class="mi">1</span><span class="p">.</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't dup Fixnum></span>
<span class="mi">1</span><span class="p">.</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't clone Fixnum></span>
<span class="mf">1.5</span><span class="p">.</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't dup Float></span>
<span class="mf">1.5</span><span class="p">.</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't clone Float></span>
<span class="no">Rational</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Rational></span>
<span class="no">Rational</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Rational></span>
<span class="no">Complex</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Complex></span>
<span class="no">Complex</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="k">rescue</span> <span class="vg">$!</span> <span class="c1"># => #<TypeError: can't copy Complex></span>
<span class="nb">require</span> <span class="s2">"bigdecimal"</span>
<span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">dup</span> <span class="c1"># => #<BigDecimal:101e270,'0.1E1',9(27)></span>
<span class="no">BigDecimal</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">clone</span> <span class="c1"># => #<BigDecimal:101dfa0,'0.1E1',9(27)></span>
</code></pre> Ruby master - Bug #13233 (Closed): [DOC] Fix rdoc for Rationalhttps://bugs.ruby-lang.org/issues/132332017-02-19T19:38:04Zstomar (Marcus Stollsteimer)
<pre><code>rational.c: fix rdoc
* rational.c: [DOC] fix wrong indentations and comment out some lines
in code examples to make them valid Ruby code and syntax highlighted
on the rendered page.
</code></pre> Ruby master - Bug #13229 (Closed): [DOC] Add document title for extension.rdochttps://bugs.ruby-lang.org/issues/132292017-02-18T15:01:47Zstomar (Marcus Stollsteimer)
<pre><code>extension.rdoc: add document title
* doc/extension.rdoc, doc/extension.ja.rdoc: [DOC]
add title and adapt subheading levels.
* doc/extension.rdoc: [DOC] fix subheading level of section
about "Ruby Constants That Can Be Accessed From C".
* doc/extension.ja.rdoc: [DOC] add missing subheading.
</code></pre> Ruby master - Bug #13225 (Closed): [DOC] expand docs for Date shiftinghttps://bugs.ruby-lang.org/issues/132252017-02-18T08:50:52Zstomar (Marcus Stollsteimer)
<pre><code>ext/date/date_core.c: [DOC] expand docs for Date shifting
* add examples for Date#>> and Date#<< that clarify some edge cases
* add examples for Date#next_year and Date#prev_year
* add cross references to Date#>> and Date#<<
</code></pre> Ruby master - Bug #13195 (Closed): bigdecimal/util.rb: [DOC] Fix documentation errorshttps://bugs.ruby-lang.org/issues/131952017-02-05T15:34:52Zstomar (Marcus Stollsteimer)
<pre><code>bigdecimal/util.rb: [DOC] Fix documentation errors
* ext/bigdecimal/lib/bigdecimal/util.rb: [DOC] fix errors
in rdoc for 'bigdecimal/util'.
Fix two errors in the docs: it's bigdecimal/util that does
extend the native classes with #to_d, not BigDecimal;
also, BigDecimal is extended with #to_d and #to_digits,
not the Numeric class.
</code></pre> Ruby master - Bug #13193 (Closed): [DOC] Revise docs for Date and DateTimehttps://bugs.ruby-lang.org/issues/131932017-02-05T09:51:38Zstomar (Marcus Stollsteimer)
<pre><code>ext/date/date_core.c: [DOC] revise docs for Date and DateTime
* fix malformed rdoc for Date#today, Date._strptime,
and DateTime._strptime
* add code examples for Date#<< and Date#>> to demonstrate
that different dates can result in the same return value
* use Date::ITALY in call-seq instead of only ITALY
* fix some copy/paste mistakes where Date should be DateTime
* fix various errors and grammar
* fix cross references and formatting
</code></pre> Ruby master - Bug #13192 (Closed): [DOC] Add example for Symbol#to_shttps://bugs.ruby-lang.org/issues/131922017-02-04T12:25:49Zstomar (Marcus Stollsteimer)
<p>The docs for Symbol#to_s only include an example for<br>
Symbol#id2name, but not for #to_s which is an alias;<br>
the docs should include examples for both methods.</p> Ruby master - Bug #13190 (Closed): [DOC] Fix error for escape sequences in string literalshttps://bugs.ruby-lang.org/issues/131902017-02-03T22:12:35Zstomar (Marcus Stollsteimer)
<p>Small change:</p>
<p>Backslash goes first in escape sequences, so it must be "any other character following a backslash is interpreted as ...", while the doc says "...followed by...".</p> Ruby master - Bug #13189 (Closed): [DOC] Restore class documentation for Structhttps://bugs.ruby-lang.org/issues/131892017-02-03T20:47:08Zstomar (Marcus Stollsteimer)
<pre><code>* struct.c: restore class documentation for Struct
that disappeared with r46663.
</code></pre>
<p>Due to r46663, the class documentation for Struct disappeared.<br>
(The revision inserted the definition of <code>InitVM_Struct</code> between<br>
the rdoc and the definition of <code>Init_Struct</code>.)</p>
<p>The docs are rendered for 2.1: <a href="https://docs.ruby-lang.org/en/2.1.0/Struct.html" class="external">https://docs.ruby-lang.org/en/2.1.0/Struct.html</a>,<br>
but not for later versions, see <a href="https://docs.ruby-lang.org/en/2.2.0/Struct.html" class="external">https://docs.ruby-lang.org/en/2.2.0/Struct.html</a>.<br>
(Same for <code>ri</code> pages).</p> Ruby master - Bug #13169 (Closed): Fix OpenStruct#each_pair return valuehttps://bugs.ruby-lang.org/issues/131692017-01-30T21:03:38Zstomar (Marcus Stollsteimer)
<pre><code>ostruct.rb: fix OpenStruct#each_pair return value
* lib/ostruct.rb (OpenStruct#each_pair): let #each_pair
with block return self instead of the internal hash table.
</code></pre>
<p>Currently OpenStruct#each_pair with block returns the internal hash table, while usually #each, #each_key, #each_byte, and similar methods return <code>self</code>. Struct#each_pair also returns <code>self</code>.</p>
<pre><code>require "ostruct"
person = OpenStruct.new(name: "John", age: 70)
person # => #<OpenStruct name="John", age=70>
person.each_pair { } # => {:name=>"John", :age=>70}
</code></pre>
<p>I don't know whether this is intended behavior or only an oversight.</p>
<p>The patch makes OpenStruct#each_pair return <code>self</code>, and also adds a test. (I do not know anything about how tests/specs in the Ruby source are organized, I hope it's fine.)</p> Ruby master - Bug #13159 (Closed): [DOC] Revise documentation for OpenStructhttps://bugs.ruby-lang.org/issues/131592017-01-25T21:03:29Zstomar (Marcus Stollsteimer)
<pre><code>* update paragraph on implementation:
define_singleton_method is used, not define_method
* add call-seq with return values for each_pair
* adopt description of dig from Array and Hash
* fix description of the hash method
* :nodoc: initialize_copy, respond_to_missing?
* other small improvements, e.g. use the term `attribute' in the docs
(instead of `member'), which is clearer for users of the class
* improve code examples: e.g. use more consistent style (always use
double quotes, drop `p' and `puts', ...), update inspect output,
use example data that is not prone to change (like population)
* add more code examples
* fix some small errors and grammar
</code></pre> Ruby master - Bug #13148 (Closed): [DOC] Small doc fix for Hash#dig and Struct#dighttps://bugs.ruby-lang.org/issues/131482017-01-22T21:23:58Zstomar (Marcus Stollsteimer)
<p>Use the correct parameter name in the method description.</p> Ruby master - Bug #13132 (Closed): [DOC] Improve documentation for Bindinghttps://bugs.ruby-lang.org/issues/131322017-01-15T16:13:42Zstomar (Marcus Stollsteimer)
<ul>
<li>remove explicit return from code examples</li>
<li>grammar fixes</li>
<li>other small fixes</li>
</ul> Ruby master - Bug #13130 (Closed): [DOC] Mention behavior of Array#join for nested arrayshttps://bugs.ruby-lang.org/issues/131302017-01-14T20:42:24Zstomar (Marcus Stollsteimer)
<p>The current documentation for Array#join does not mention the special treatment of nested arrays.</p>
<p>It says:</p>
<blockquote>
<p>Returns a string created by converting each element of the array to a string, separated by the given separator.</p>
</blockquote>
<p>Expected behavior according to the docs would be:</p>
<pre><code>[ "a", [1, 2, [:x, :y]], "b" ].join("-") #=> "a-[1, 2, [:x, :y]]-b"
# because of:
[1, 2, [:x, :y]].to_s #=> "[1, 2, [:x, :y]]"
</code></pre>
<p>Actual behavior:</p>
<pre><code>[ "a", [1, 2, [:x, :y]], "b" ].join("-") #=> "a-1-2-x-y-b"
</code></pre>
<p>because join is applied recursively for nested arrays.</p>
<p>The patch clarifies this behavior.</p>
<p>(Also: small markup and grammar fix.)</p> Ruby master - Bug #13029 (Closed): Update doc/contributors.rdochttps://bugs.ruby-lang.org/issues/130292016-12-13T20:23:47Zstomar (Marcus Stollsteimer)
<p>As the file says "Feel free to add your name if your patch was accepted into Ruby".</p>
<p>Some of my patches:</p>
<p>HTML5 tag maker patch: <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Add HTML5 support to CGI (Closed)" href="https://bugs.ruby-lang.org/issues/6637">#6637</a> and <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: CGI: Add support for HTML5 <header> tag (Closed)" href="https://bugs.ruby-lang.org/issues/7110">#7110</a><br>
documentation patches: <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [DOC] Convert DateTime documentation to RDoc (Closed)" href="https://bugs.ruby-lang.org/issues/12311">#12311</a>, <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [DOC] Language improvements for doc/extension.rdoc (Closed)" href="https://bugs.ruby-lang.org/issues/12246">#12246</a>, <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [DOC] Fix errors in doc/extension*.rdoc (Closed)" href="https://bugs.ruby-lang.org/issues/12228">#12228</a>, <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [DOC] Several fixes for the BigDecimal documentation (Closed)" href="https://bugs.ruby-lang.org/issues/10576">#10576</a>, and others;<br>
and main committer on <a href="http://www.ruby-lang.org" class="external">www.ruby-lang.org</a></p> Ruby master - Bug #12313 (Closed): [DOC] Fix two code sampleshttps://bugs.ruby-lang.org/issues/123132016-04-23T15:56:04Zstomar (Marcus Stollsteimer)
<p>Two tiny fixes of code samples, in Encoding and BigDecimal.</p> Ruby master - Bug #12311 (Closed): [DOC] Convert DateTime documentation to RDochttps://bugs.ruby-lang.org/issues/123112016-04-22T15:12:03Zstomar (Marcus Stollsteimer)
<p>The docs for DateTime are written in Markdown, the patch converts it to the RDoc format.<br>
This fixes syntax highlighting of some code examples and also enables the accustomed auto linking of classes and methods.</p> Ruby master - Bug #12258 (Closed): RDoc bug when handling comments in C code exampleshttps://bugs.ruby-lang.org/issues/122582016-04-07T14:47:15Zstomar (Marcus Stollsteimer)
<p>RDoc fails to correctly convert documentation that includes C example code with <code>/* ... */</code> comments.</p>
<p>It does not only produce wrong output for the comment itself (stripping the <code>/*</code> and <code>*/</code>), but also gets confused with occurences of <code>*</code> in completely different parts of the documentation, so that e.g. lists are displayed as code blocks. It appears that <code>*</code> at the very beginning of a line triggers a code block under these circumstances.</p>
<p>This affects e.g. <a href="http://docs.ruby-lang.org/en/trunk/extension_rdoc.html#label-Check+Data+Type+of+the+VALUE" class="external">http://docs.ruby-lang.org/en/trunk/extension_rdoc.html#label-Check+Data+Type+of+the+VALUE</a> (partially stripped <code>/*</code> and <code>*/</code> from code example) or <a href="http://docs.ruby-lang.org/en/2.2.0/README_EXT.html#label-Adding+New+Features+to+Ruby" class="external">http://docs.ruby-lang.org/en/2.2.0/README_EXT.html#label-Adding+New+Features+to+Ruby</a> (list displayed as code block); note that the broken list is fixed in trunk (it's rather a workaround) by using "-" for the list items.</p>
<p>Minimal example for a pure rdoc page:</p>
<pre><code>$ cat broken_page.rdoc
A list:
* item 1
* item 2
A sentence with *emphasis* directly at the
*start* of a line.
Some example C code with comment:
void
do_something(VALUE val)
{
/* comment */
}
</code></pre>
<p>For this rdoc produces:</p>
<p>A list:</p>
<pre><code>item 1
item 2
</code></pre>
<p>A sentence with <strong>emphasis</strong> directly at the</p>
<pre><code>start* of a line.
</code></pre>
<p>Some example C code with comment:</p>
<pre><code>void
do_something(VALUE val)
{
comment
}
</code></pre>
<p>When generating rdoc of a Ruby class, the bug affects only the code example itself:</p>
<pre><code>$ cat broken.rb
# A class with broken rdoc.
#
# A list:
#
# * item 1
# * item 2
#
# A sentence with *emphasis* directly at the
# *start* of a line.
#
# Some example C code with comment:
#
# void
# do_something(VALUE val)
# {
# /* comment */
# }
#
class Broken
end
</code></pre>
<p>This produces:</p>
<p>A class with broken rdoc.</p>
<p>A list:</p>
<ul>
<li>item 1</li>
<li>item 2</li>
</ul>
<p>A sentence with <strong>emphasis</strong> directly at the <strong>start</strong> of a line.</p>
<p>Some example C code with comment:</p>
<pre><code>void
do_something(VALUE val)
{
comment
}
</code></pre> Ruby master - Bug #12255 (Closed): [DOC] Small fix for rdoc of ext/json/lib/json/add/*https://bugs.ruby-lang.org/issues/122552016-04-06T19:23:21Zstomar (Marcus Stollsteimer)
<p>This patch removes some comments that otherwise would appear in the docs of the affected classes.</p>
<p>E.g. for Exception</p>
<pre><code>$ ri Exception
Descendants of class Exception are used to [...]
[snipped class documentation]
Exception serialization/deserialization <- does not belong here!
-------------------------------------------
Class methods:
[snip]
</code></pre> Ruby master - Bug #12246 (Closed): [DOC] Language improvements for doc/extension.rdochttps://bugs.ruby-lang.org/issues/122462016-04-02T20:49:28Zstomar (Marcus Stollsteimer)
<p>The patch provides several language improvements for doc/extension.rdoc.</p> Ruby master - Bug #12228 (Closed): [DOC] Fix errors in doc/extension*.rdochttps://bugs.ruby-lang.org/issues/122282016-03-29T13:48:47Zstomar (Marcus Stollsteimer)
<p>Fix some errors in extension.rdoc and extension.ja.rdoc, that I noticed by comparing those two files.<br>
(Renamed files, wrong method names or argument types; the example GetDBM macro is now updated to the current version of the actual code.)</p> Ruby master - Bug #12143 (Closed): [DOC] Fix RDoc markup in doc/extension*.rdochttps://bugs.ruby-lang.org/issues/121432016-03-04T16:40:26Zstomar (Marcus Stollsteimer)
<p>This patch fixes broken RDoc in extension.rdoc and extension.ja.rdoc.</p>
<p>E.g. fixing labelled lists, comments (# -> -- / ++),<br>
escaping (ary[offset] would else be a link, #to_str would not render correctly,<br>
(c) would render as copyright sign), and some syncing of en/ja.</p>
<p>I'm not sure what happens with '*' at the beginning of a line<br>
(this might be an RDoc bug): it seems to trigger a code block,<br>
so I escaped it or used <code><b></b></code> or used '-' for an unordered list.</p> Ruby master - Bug #12111 (Closed): [DOC] Small fix for extension.roc / extension.ja.rdochttps://bugs.ruby-lang.org/issues/121112016-02-25T19:17:52Zstomar (Marcus Stollsteimer)
<p>The patch removes the local variables list for Emacs,<br>
since they show up in the rendered page; see the very end<br>
of <a href="http://docs.ruby-lang.org/en/trunk/extension_rdoc.html" class="external">http://docs.ruby-lang.org/en/trunk/extension_rdoc.html</a></p> Ruby master - Bug #10576 (Closed): [DOC] Several fixes for the BigDecimal documentationhttps://bugs.ruby-lang.org/issues/105762014-12-06T13:56:31Zstomar (Marcus Stollsteimer)
<p>Patch 1:</p>
<p>Clarify the return value types of abs, fix, and frac.</p>
<p>(They return the results as a BigDecimal; targeted against misunderstandings like issue <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: BigDecimal#fix returns a BigDecimal object instead of a Integer (Rejected)" href="https://bugs.ruby-lang.org/issues/10569">#10569</a>).</p>
<p>Patch 2:</p>
<p>Several fixes for the BigDecimal documentation:</p>
<ul>
<li>fix broken labeled lists,</li>
<li>fix formatting of code examples,</li>
<li>fix/improve some call-seq's,</li>
<li>small improvements.</li>
</ul> Ruby master - Bug #10526 (Closed): [DOC] Revise documentation in object.chttps://bugs.ruby-lang.org/issues/105262014-11-19T21:31:36Zstomar (Marcus Stollsteimer)
<ul>
<li>#inspect: be more specific about generated string, remove obsolete example</li>
<li>#nil?: use code examples instead of different call-seq's</li>
<li>#tap: clarify what is yielded</li>
<li>Integer(): be more specific about to_int and to_i, remove reference to Ruby 1.8</li>
<li>Array(): fix error</li>
<li>Class: fix variable name style and indentation in example</li>
<li>improve consistency, fix typos and formatting</li>
</ul>
<p>Further notes:</p>
<p>regarding #inspect: since r36709 it is decoupled from #to_s, so the example is meaningless<br>
regarding #nil?: the call-seq's are not rendered correctly on ruby-doc.org, see <a href="http://ruby-doc.org/core-2.1.5/Object.html#method-i-nil-3F" class="external">http://ruby-doc.org/core-2.1.5/Object.html#method-i-nil-3F</a></p> Ruby master - Bug #9684 (Closed): Use same error messages in struct.chttps://bugs.ruby-lang.org/issues/96842014-03-27T13:59:15Zstomar (Marcus Stollsteimer)
<p>In <code>struct.c</code>, use the same error message "`foo' is not a struct member" in</p>
<ul>
<li>
<code>rb_struct_getmember</code> (line 97) and</li>
<li>
<code>rb_struct_set</code> (lines 157)</li>
</ul> Ruby master - Bug #9682 (Closed): [Doc] Improve Time.parse documentation (in lib/time)https://bugs.ruby-lang.org/issues/96822014-03-27T13:42:09Zstomar (Marcus Stollsteimer)
<p>Consistently use EST like all other examples in lib/time.<br>
Also tries to clarify the behaviour by adding a comment with the return value of Time.parse in the given example.</p>
<p>See discussion on <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [Doc] Fix error in Time.parse documentation (in lib/time) (Closed)" href="https://bugs.ruby-lang.org/issues/9521">#9521</a>.</p> Ruby master - Bug #9662 (Closed): [Doc] Typo in README.EXThttps://bugs.ruby-lang.org/issues/96622014-03-22T09:28:12Zstomar (Marcus Stollsteimer)
<p>Enumerate module -> Enumerable module</p> Ruby master - Bug #9543 (Closed): [Doc] Fix example in GServer documentation (lib/gserver)https://bugs.ruby-lang.org/issues/95432014-02-20T19:34:23Zstomar (Marcus Stollsteimer)
<p>The code example does not match its description: the server should return time in seconds since 1970.</p>
<p>Patch appended (Time.now.to_s -> Time.now.to_i).</p>
<p>Also fixes some minor typos and inconsistencies.</p> Ruby master - Bug #9521 (Closed): [Doc] Fix error in Time.parse documentation (in lib/time)https://bugs.ruby-lang.org/issues/95212014-02-15T17:05:16Zstomar (Marcus Stollsteimer)
<p>The docs state that the examples are for GMT as local time zone while in fact they are for JST.<br>
The patch fixes this by using EST (and saying so), like the rest of the examples for lib/time.</p> Ruby master - Bug #9258 (Closed): Fix bugreport URL in error.chttps://bugs.ruby-lang.org/issues/92582013-12-18T22:57:21Zstomar (Marcus Stollsteimer)
<p>error.c refers to <www.ruby-lang.org/bugreport.html> in REPORTBUG_MSG, which is only a redirect to <bugs.ruby-lang.org>. Instead it should refer to bugs.ruby-lang.org directly:</p>
<ul>
<li>it's the "canonical" ressource for anything bug-related</li>
<li>it's already linked to from many other source files</li>
</ul> Ruby master - Bug #9027 (Closed): [Doc] improve rdoc of Digest modulehttps://bugs.ruby-lang.org/issues/90272013-10-16T20:35:38Zstomar (Marcus Stollsteimer)
<p>Some improvements in mainly the module documentation:</p>
<ul>
<li>provide more examples</li>
<li>provide a working example for the "bubble babble" encoding</li>
<li>fix dead link</li>
<li>fix some typos</li>
</ul>
<p>(Right now the "bubble babble" thing is completely unclear or rather<br>
essentially undocumented; also the linked to Wikipedia article has been<br>
deleted. I also added examples for MD5--which is otherwise undocumented--,<br>
for different encodings, and for creating a digest for a file.)</p> Ruby master - Bug #9021 (Closed): [Doc] typos in rdoc of Digest modulehttps://bugs.ruby-lang.org/issues/90212013-10-15T05:02:05Zstomar (Marcus Stollsteimer)
<p>Fixes minor typos in Digest module docs.</p> Ruby master - Bug #8867 (Closed): Mailing lists' controller addresses not workinghttps://bugs.ruby-lang.org/issues/88672013-09-06T00:05:39Zstomar (Marcus Stollsteimer)
<p>This probably isn't the right place to report this, but I do not know a better one...</p>
<p>The controller addresses for the various mailing lists do not seem to work anymore:<br>
<a href="mailto:ruby-talk-ctl@ruby-lang.org" class="email">ruby-talk-ctl@ruby-lang.org</a>, <a href="mailto:ruby-core-ctl@ruby-lang.org" class="email">ruby-core-ctl@ruby-lang.org</a>, ...</p>
<pre><code>Mail delivery failed: returning message to sender
SMTP error from remote server after RCPT command:
host: neon.ruby-lang.org
5.1.1 <ruby-doc-ctl@ruby-lang.org>: Recipient address rejected: User unknown in local recipient table
</code></pre>
<p>That means it's not possible to subscribe/unsubscribe right now.</p>
<p>I already count about 450 failed subscribe/unsubscribe requests through the subscription form on <a href="http://www.ruby-lang.org" class="external">www.ruby-lang.org</a>.</p>
<p>This started on 2013/08/06.</p> Ruby master - Bug #8854 (Closed): Update URL for bug reportshttps://bugs.ruby-lang.org/issues/88542013-09-03T16:36:06Zstomar (Marcus Stollsteimer)
<p>The URL in error.c has recently been changed from<br>
<a href="http://www.ruby-lang.org/bugreport.html" class="external">www.ruby-lang.org/bugreport.html</a> to bugs.ruby-lang.org.</p>
<p>I am guessing(!) that the URL in test/ruby/test_rubyoptions.rb<br>
should match the URL in error.c, see patch.</p>
<p>I couldn't test this, though.</p> Ruby master - Bug #8613 (Closed): Update to rdoc 4.0.1https://bugs.ruby-lang.org/issues/86132013-07-09T14:57:26Zstomar (Marcus Stollsteimer)
<p>Please update rdoc from 4.0.0 to 4.0.1 in trunk and in 2.0.0 branch.</p>
<p>rdoc 4.0.1 fixes an issue with ri doc installation, see also</p>
<ul>
<li>issue <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: rdoc issues preventing docs generating after ruby was compiled (Rejected)" href="https://bugs.ruby-lang.org/issues/8037">#8037</a></li>
<li><a href="https://github.com/rdoc/rdoc/issues/193" class="external">https://github.com/rdoc/rdoc/issues/193</a></li>
<li><a href="https://github.com/rdoc/rdoc/issues/194" class="external">https://github.com/rdoc/rdoc/issues/194</a></li>
</ul>
<p>Regards,<br>
Marcus</p> Ruby master - Bug #7504 (Closed): Rdoc for OptionParser (remove "developer documentation" from Rd...https://bugs.ruby-lang.org/issues/75042012-12-04T00:25:42Zstomar (Marcus Stollsteimer)
<p>The rdoc for OptionParser starts with "developer documentation"<br>
that's "not for RDoc output", which is a little strange.</p>
<p>In case this is not intentional for some reason, the patch removes<br>
this part of the docs from the output (using <code>#--' / </code>#++').</p> Ruby master - Bug #7465 (Closed): Rdoc for CGI (html generation example)https://bugs.ruby-lang.org/issues/74652012-11-29T16:04:57Zstomar (Marcus Stollsteimer)
<p>I "modernized" the example for HTML generation a little,<br>
it now produces HTML4 Strict, validated with the W3C validator<br>
(there only remain warnings for missing charset information;<br>
an ACTION attribute and a </p><p> element had to be added).</p>
<p>I also changed the formatting and replaced some string concatenation<br>
by string interpolation.</p> Ruby master - Bug #7405 (Closed): Rdoc for CGI#header aliashttps://bugs.ruby-lang.org/issues/74052012-11-20T00:30:33Zstomar (Marcus Stollsteimer)
<p>=begin<br>
CGI#header was only reintroduced as alias for CGI#http_header for compatibility reasons (see <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: CGI#header が 1.9.3 と異なる挙動となっている (Closed)" href="https://bugs.ruby-lang.org/issues/7286">#7286</a>), it's use for this purpose is deprecated. This should be made clear in the rdoc (patch provided):</p>
<pre><code>This method is an alias for #http_header, as long as the
HTML5 tag maker is not used.
NOTE: #header should no longer be used to create HTTP header
blocks, the alias is provided only for backwards compatibility.
With the HTML5 tag maker #header creates a <header> element.
</code></pre>
<p>=end</p> Ruby master - Bug #7198 (Third Party's Issue): No documentation of Psych on ruby-doc.orghttps://bugs.ruby-lang.org/issues/71982012-10-20T16:10:53Zstomar (Marcus Stollsteimer)
<p>=begin<br>
The documentation for the Psych module does not show up on <a href="http://www.ruby-doc.org/stdlib-1.9.3/" class="external">http://www.ruby-doc.org/stdlib-1.9.3/</a>.<br>
=end</p> Ruby master - Bug #7110 (Closed): CGI: Add support for HTML5 <header> taghttps://bugs.ruby-lang.org/issues/71102012-10-05T22:22:32Zstomar (Marcus Stollsteimer)
<p>=begin<br>
These patches add the tag to CGI's HTML generation methods, finalizing the support of HTML5, see <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Add HTML5 support to CGI (Closed)" href="https://bugs.ruby-lang.org/issues/6637">#6637</a>. </p>
<p>Note that the old CGI#header method is renamed to CGI#http_header. CGI#header now generates a HTML5 header element.<br>
=end</p> Ruby master - Bug #7062 (Closed): Rdoc for String#=~https://bugs.ruby-lang.org/issues/70622012-09-24T04:46:46Zstomar (Marcus Stollsteimer)
<p>=begin<br>
This patch clarifies the different behaviour for str =~ regexp and regexp =~ str regarding captured strings and assigning to local variables. (See also issue <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: String#=~ is not equal to Regexp#=~ (Rejected)" href="https://bugs.ruby-lang.org/issues/7042">#7042</a>.)</p>
<p>Added text:</p>
<p>Note: <code>str =~ regexp</code> is not the same as<br>
<code>regexp =~ str</code>. Strings captured from named capture groups<br>
are not assigned to local variables in the first case.<br>
=end</p> Ruby master - Bug #6835 (Closed): Rdoc for DateTime#strftime('%Q') says 'microseconds' instead if...https://bugs.ruby-lang.org/issues/68352012-08-04T23:34:03Zstomar (Marcus Stollsteimer)
<p>=begin<br>
The patch fixes wrong rdoc for %Q, which returns the number of ((<em>milli</em>))seconds since the unix epoch, not ((<em>micro</em>))seconds.</p>
<p>(This is also the expected behavior according to the tests in test/date/test_date_strftime.rb)</p>
<p>This affects also Ruby 1.8.</p>
<p>1.9.3p194 :001 > require 'date'<br>
1.9.3p194 :002 > d = DateTime.parse('1970-01-01T00:00:05.123456+00:00')<br>
=> #<DateTime: 1970-01-01T00:00:05+00:00 ((2440588j,5s,123456000n),+0s,2299161j)><br>
1.9.3p194 :003 > d.strftime('%s')<br>
=> "5"<br>
1.9.3p194 :004 > d.strftime('%Q')<br>
=> "5123"<br>
=end</p> Ruby master - Bug #6759 (Closed): rdoc for Logger class (improve example)https://bugs.ruby-lang.org/issues/67592012-07-20T21:10:31Zstomar (Marcus Stollsteimer)
<p>=begin<br>
the patch improves the main example</p>
<ul>
<li>more consistent with the other examples (log -> logger)</li>
<li>avoids syntax errors<br>
=end</li>
</ul> Ruby master - Bug #6749 (Closed): rdoc of Time class (incorrect explanation of leap seconds)https://bugs.ruby-lang.org/issues/67492012-07-18T05:13:02Zstomar (Marcus Stollsteimer)
<p>The patch fixes the documentation of Time#sec,<br>
where an incorrect explanation of leap seconds is given.</p> Ruby master - Bug #6738 (Closed): Typos / corrections in rdoc for Logger libraryhttps://bugs.ruby-lang.org/issues/67382012-07-16T02:19:15Zstomar (Marcus Stollsteimer)
<p>=begin<br>
The attached patch fixes typos in the rdoc of lib/logger.rb.<br>
=end</p> Ruby master - Bug #6680 (Closed): Unclear rdoc for Array and String slicinghttps://bugs.ruby-lang.org/issues/66802012-07-01T07:27:01Zstomar (Marcus Stollsteimer)
<p>=begin<br>
Slicing of arrays and strings specifying start/length or using a range is not documented well, and often leads to confusion, see for example</p>
<p><a href="http://stackoverflow.com/questions/3568222/array-slicing-in-ruby-looking-for-explanation-for-illogical-behaviour-taken-fr" class="external">http://stackoverflow.com/questions/3568222/array-slicing-in-ruby-looking-for-explanation-for-illogical-behaviour-taken-fr</a></p>
<p>or</p>
<p><a href="http://www.ruby-forum.com/topic/1393096#990065" class="external">http://www.ruby-forum.com/topic/1393096#990065</a></p>
<p>The attached patch tries to clarify the documentation.<br>
=end</p> Backport187 - Backport #6656 (Closed): Time#strftime('%Z') should return 'UTC' instead of 'GMT'https://bugs.ruby-lang.org/issues/66562012-06-27T21:15:44Zstomar (Marcus Stollsteimer)
<p>=begin<br>
Time#strftime('%Z') should return 'UTC' instead of 'GMT',<br>
as in Time#to_s and Time#zone. This is also the behaviour of Ruby 1.9.3.</p>
<p>irb(main):001:0> Time.utc(2012, 6, 27).to_s<br>
=> "Wed Jun 27 00:00:00 UTC 2012"<br>
irb(main):002:0> Time.utc(2012, 6, 27).zone<br>
=> "UTC"<br>
irb(main):003:0> Time.utc(2012, 6, 27).strftime('%Z')<br>
=> "GMT"<br>
=end</p> Ruby master - Feature #6637 (Closed): Add HTML5 support to CGIhttps://bugs.ruby-lang.org/issues/66372012-06-24T06:53:50Zstomar (Marcus Stollsteimer)
<p>=begin<br>
The attached patch adds support for HTML 5, providing<br>
the doctype and the tag helpers for the<br>
new HTML elements (article, section, ...).</p>
<p>Changes were made in</p>
<ul>
<li>`lib/cgi/core.rb'</li>
<li>`lib/cgi/html.rb'</li>
</ul>
<p>Tests were added to</p>
<ul>
<li>`test/cgi/test_cgi_core.rb'</li>
</ul>
<p>((<em>Notice:</em>)) the new HTML5 `header' element has ((<em>not</em>)) been added,<br>
because it collides with the already defined CGI#header<br>
method that creates the HTTP header block.<br>
To avoid unreflected addition of this element, a test has<br>
been included to make sure that CGI#header won't break.</p>
<p>Detailed list of changes in `html.rb' (in comparison to HTML 4 strict):</p>
<ul>
<li>doctype changed</li>
<li>new elements added</li>
<li>removed elements: tt, big, acronym</li>
<li>void elements: area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr</li>
<li>new elements with optional end tag: optgroup, rt, rp</li>
</ul>
<p>See the Editor's Draft of the HTML5 specification (15 June 2012):<br>
((<a href="URL:http://dev.w3.org/html5/spec/" class="external">URL:http://dev.w3.org/html5/spec/</a>)).<br>
=end</p> Ruby master - Bug #6632 (Closed): Typos in CGI (core.rb)https://bugs.ruby-lang.org/issues/66322012-06-23T20:32:05Zstomar (Marcus Stollsteimer)
<p>Fixes typos: wrong call-seq in rdoc / trailing whitespaces</p>