diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/optparse.rb | 12 |
2 files changed, 10 insertions, 6 deletions
@@ -1,3 +1,7 @@ +Fri Sep 8 08:25:39 2006 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * lib/optparse.rb: suppress `assigning void value' warning. + Fri Sep 8 01:16:34 2006 Yukihiro Matsumoto <matz@ruby-lang.org> * array.c (Init_Array): #to_s to be an alias to #inspect. diff --git a/lib/optparse.rb b/lib/optparse.rb index 5c24eb3629..305f828e0e 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -786,7 +786,7 @@ class OptionParser def add_officious # :nodoc: list = base() Officious.each do |opt, block| - list.long[opt] ||= block.yield(self) + list.long[opt] ||= block.call(self) end end @@ -1251,7 +1251,7 @@ class OptionParser end begin opt, sw, val = sw.parse(rest, argv) {|*exc| raise(*exc)} - sw.yield(val) if sw + sw.call(val) if sw rescue ParseError raise $!.set_option(arg, rest) end @@ -1281,7 +1281,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.yield(val) if sw + sw.call(val) if sw rescue ParseError raise $!.set_option(arg, arg.length > 2) end @@ -1290,9 +1290,9 @@ class OptionParser else catch(:prune) do visit(:each_option) do |sw| - sw.block.yield(arg) if Switch === sw and sw.match_nonswitch?(arg) + sw.block.call(arg) if Switch === sw and sw.match_nonswitch?(arg) end - nonopt.yield(arg) + nonopt.call(arg) end end end @@ -1300,7 +1300,7 @@ class OptionParser nil } - visit(:search, :short, nil) {|sw| sw.block.yield(argv) if !sw.pattern} + visit(:search, :short, nil) {|sw| sw.block.call(argv) if !sw.pattern} argv end |