diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-09 23:18:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-09 23:18:04 +0000 |
commit | 3e5f70a8153f8ec955af1c6bc721f2e3ea1814a5 (patch) | |
tree | 29da7e6c2a3d146f50323f12573e3ba4fb5bbb64 /lib/optparse.rb | |
parent | 4b731d3bc973dae866211d6f6f9574300718cfe7 (diff) | |
download | ruby-3e5f70a8153f8ec955af1c6bc721f2e3ea1814a5.tar.gz |
* math.c (log2): may be a macro.
* parse.y (args, block_param, f_args): pass f_post_arg to #params.
* util.c (powersOf10): constified.
* ext/readline/readline.c: include extconf.h first.
* ext/ripper/eventids2.c: removed tLAMBDA_ARG.
* ext/tk/tcltklib.c (lib_fromUTF8_core): removed conflict.
* ext/tk/tkutil/tkutil.c (cbsubst_get_subst_arg): rb_id2name() is
defined as const now.
* ext/win32ole/win32ole.c (fole_missing): ditto.
* lib/mkmf.rb (create_makefile): force to create extconf header.
* lib/optparse.rb (order!): use Proc#yield.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/optparse.rb')
-rw-r--r-- | lib/optparse.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index 9c7676f4be..13528f98dc 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -355,7 +355,7 @@ class OptionParser def conv_arg(arg, val = []) if block if conv - val = conv.call(*val) + val = conv.yield(*val) else val = val[0] end @@ -849,7 +849,7 @@ class OptionParser def add_officious list = base() Officious.each do |opt, block| - list.long[opt] ||= block.call(self) + list.long[opt] ||= block.yield(self) end end @@ -1319,7 +1319,7 @@ class OptionParser end begin opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)} - sw.call(*val) if sw + sw.yield(*val) if sw rescue ParseError raise $!.set_option(arg, rest) end @@ -1328,7 +1328,8 @@ class OptionParser when /\A-(.)((=).*|.+)?/nm opt, has_arg, eq, val, rest = $1, $3, $3, $2, $2 begin - unless sw = search(:short, opt) + sw, = search(:short, opt) + unless sw begin sw, = complete(:short, opt) # short option matched. @@ -1348,7 +1349,7 @@ class OptionParser opt, sw, 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-*/, '-')) != '-' - sw.call(val) if sw + sw.yield(val) if sw rescue ParseError raise $!.set_option(arg, arg.length > 2) end @@ -1357,9 +1358,9 @@ class OptionParser else catch(:prune) do visit(:each_option) do |sw| - sw.block.call(arg) if Switch === sw and sw.match_nonswitch?(arg) + sw.block.yield(arg) if Switch === sw and sw.match_nonswitch?(arg) end - nonopt.call(arg) + nonopt.yield(arg) end end end @@ -1367,7 +1368,7 @@ class OptionParser nil } - visit(:search, :short, nil) {|sw| sw.block.call(argv) if !sw.pattern} + visit(:search, :short, nil) {|sw| sw.block.yield(argv) if !sw.pattern} argv end |