ruby-changes:9364
From: nobu <ko1@a...>
Date: Sun, 21 Dec 2008 14:55:35 +0900 (JST)
Subject: [ruby-changes:9364] Ruby:r20902 (trunk): * lib/optparse.rb (SPLAT_PROC): splat values by hand.
nobu 2008-12-21 14:55:20 +0900 (Sun, 21 Dec 2008) New Revision: 20902 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20902 Log: * lib/optparse.rb (SPLAT_PROC): splat values by hand. Modified files: trunk/ChangeLog trunk/lib/optparse.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 20901) +++ ChangeLog (revision 20902) @@ -1,11 +1,7 @@ -Sun Dec 21 14:48:51 2008 TAKAO Kouji <kouji@t...> +Sun Dec 21 14:55:18 2008 Nobuyoshi Nakada <nobu@r...> - * test/readline/test_readline_history.rb: checked encoding. + * lib/optparse.rb (SPLAT_PROC): splat values by hand. -Sun Dec 21 14:45:58 2008 Nobuyoshi Nakada <nobu@r...> - - * lib/optparse.rb (parse_in_order): splat values to be passed. - Sun Dec 21 13:50:37 2008 TAKAO Kouji <kouji@t...> * test/readline/test_readline.rb Index: lib/optparse.rb =================================================================== --- lib/optparse.rb (revision 20901) +++ lib/optparse.rb (revision 20902) @@ -996,7 +996,7 @@ end private :notwice - SPLAT_PROC = proc {|*a| next *a} + SPLAT_PROC = proc {|*a| a.length <= 1 ? a.first : a} # # Creates an OptionParser::Switch from the parameters. The parsed argument # value is passed to the given block, where it can be processed. @@ -1263,7 +1263,7 @@ end begin opt, cb, val = sw.parse(rest, argv) {|*exc| raise(*exc)} - val = cb.call(*val) if cb + val = cb.call(val) if cb setter.call(sw.switch_name, val) if setter rescue ParseError raise $!.set_option(arg, rest) @@ -1294,7 +1294,7 @@ opt, cb, val = sw.parse(val, argv) {|*exc| raise(*exc) if eq} raise InvalidOption, arg if has_arg and !eq and arg == "-#{opt}" argv.unshift(opt) if opt and (opt = opt.sub(/\A-*/, '-')) != '-' - val = cb.call(*val) if cb + val = cb.call(val) if cb setter.call(sw.switch_name, val) if setter rescue ParseError raise $!.set_option(arg, arg.length > 2) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/