From: noreply@... Date: 2007-03-22T03:01:59+09:00 Subject: [ ruby-Bugs-8384 ] Discrepancy between GetoptLong.new and documentation Bugs item #8384, was opened at 2007-02-02 10:06 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=8384&group_id=426 Category: Standard Library Group: 1.8.5 Status: Open Resolution: None Priority: 3 Submitted By: Roel Harbers (rharbers) Assigned to: Nobody (None) Summary: Discrepancy between GetoptLong.new and documentation Initial Comment: According to the documentation for getoptlong.rb, the GetoptLong.new method requires an array of arrays to be passed: # The options to support are passed to new() as an array of arrays. # Each sub-array contains any number of String option names which carry # the same meaning, and one of the following flags: However, this code fails: require 'getoptlong' options = GetoptLong.new( [ ['-a', GetoptLong::NO_ARGUMENT], ['-b', GetoptLong::NO_ARGUMENT], ] ) This works: require 'getoptlong' options = GetoptLong.new( ['-a', GetoptLong::NO_ARGUMENT], ['-b', GetoptLong::NO_ARGUMENT] ) Either the documentation could be fixed, or the call could accept an array of arrays. Personally, I prefer the latter, since it allows something like this: options = GetoptLong.new( [ ['-a', GetoptLong::NO_ARGUMENT], ['-b', GetoptLong::NO_ARGUMENT], # ['--debug', GetoptLong::NO_ARGUMENT], ] ) which the other form does not allow without removing the comma from the -b line too. I made a patch againt 1.8.5 that lets set_options (and by extension initialize) accept both forms. What do you people think? ---------------------------------------------------------------------- >Comment By: Roel Harbers (rharbers) Date: 2007-03-21 19:01 Message: Anyone? class? Bueller? ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=8384&group_id=426