[ruby-core:69620] [Ruby trunk - Bug #10928] optparse Switch#summarize code doesn't reflect its documentation

From: antondavydov.o@...
Date: 2015-06-16 22:17:36 UTC
List: ruby-core #69620
Issue #10928 has been updated by Anton Davydov.


Hello,

> However, the actual method definition line shows otherwise, namely an Array.

In documentations says that `sdone` and `ldone` options take keyed hash. It's mean that this options take array with hash keys.

> The `OptionParser#summarize` command does actually invoke it with Hashes as arguments (line 566): `visit(:summarize, {}, {}, width, max, indent, &blk)`.

It's different methods. In first case it's `Switch#summarize` and in second case it's `OptionParser#summarize`.

----------------------------------------
Bug #10928: optparse Switch#summarize code doesn't reflect its documentation
https://bugs.ruby-lang.org/issues/10928#change-52963

* Author: Thomas Leitner
* Status: Open
* Priority: Low
* Assignee: 
* ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
The documentation for `Switch#summarize` says "+sdone+::  Already summarized short style options keyed hash." for the `sdone` argument (similar problem with `ldone`). I.e. it mentions it should be a Hash.

However, the actual method definition line shows otherwise, namely an Array.

~~~
def summarize(sdone = [], ldone = [], width = 1, max = width - 1, indent = "")
~~~

The `OptionParser#summarize` command does actually invoke it with Hashes as arguments (line 566): `visit(:summarize, {}, {}, width, max, indent, &blk)`.

So the method definition for `Switch#summarize` is probably false.



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

In This Thread

Prev Next