[Groonga-commit] groonga/grntest [master] Count arguments by each_with_index instead of "+=" method

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 6日 (水) 14:49:07 JST


Haruka Yoshihara	2012-06-06 14:49:07 +0900 (Wed, 06 Jun 2012)

  New Revision: 459c160566a92ed00edb564e6daacec8326ffe58

  Log:
    Count arguments by each_with_index instead of "+=" method

  Modified files:
    lib/groonga/tester.rb

  Modified: lib/groonga/tester.rb (+2 -4)
===================================================================
--- lib/groonga/tester.rb    2012-06-06 14:44:15 +0900 (f0255a8)
+++ lib/groonga/tester.rb    2012-06-06 14:49:07 +0900 (d9cd2c6)
@@ -642,9 +642,8 @@ module Groonga
         converted_values = {}
         last_argument = ""
 
-        arguments_count = 0
         last_parameter = ""
-        arguments.each do |argument|
+        arguments.each_with_index do |argument, count|
           next if argument.empty?
           if argument =~ /\A--/
             last_parameter = argument.sub(/\A--/, "")
@@ -653,7 +652,7 @@ module Groonga
 
           if last_parameter.empty?
             query_parameter =
-              arguments_name(command)[arguments_count]
+              arguments_name(command)[count]
           else
             query_parameter = last_parameter
           end
@@ -661,7 +660,6 @@ module Groonga
           value = argument
           converted_values =
               converted_values.merge(query_parameter => value)
-          arguments_count += 1
           last_argument = ""
         end
         converted_values




Groonga-commit メーリングリストの案内
Back to archive index