[Groonga-commit] droonga/droonga-engine at 31bf7cf [master] catalog-generator: remove needless instance variable

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Jul 17 20:33:53 JST 2014


Kouhei Sutou	2014-07-17 20:33:53 +0900 (Thu, 17 Jul 2014)

  New Revision: 31bf7cff88cdd15b5c562c352479d65ba7a035a8
  https://github.com/droonga/droonga-engine/commit/31bf7cff88cdd15b5c562c352479d65ba7a035a8

  Message:
    catalog-generator: remove needless instance variable

  Modified files:
    lib/droonga/catalog_generator.rb

  Modified: lib/droonga/catalog_generator.rb (+4 -7)
===================================================================
--- lib/droonga/catalog_generator.rb    2014-07-17 20:30:12 +0900 (8f04d01)
+++ lib/droonga/catalog_generator.rb    2014-07-17 20:33:53 +0900 (8f842a6)
@@ -205,14 +205,12 @@ module Droonga
         @port       = options[:port]     || DEFAULT_PORT
         @tag        = options[:tag]      || DEFAULT_TAG
         @n_slices   = options[:n_slices] || DEFAULT_N_SLICES
-
-        @n_volumes = 0
       end
 
       def to_catalog
         slices = []
-        @n_slices.times do
-          slices << catalog_slice
+        @n_slices.times do |i|
+          slices << catalog_slice(i)
         end
         {
           "dimension" => "_key",
@@ -222,9 +220,8 @@ module Droonga
       end
 
       private
-      def catalog_slice
-        name = sprintf('%03d', @n_volumes)
-        @n_volumes += 1
+      def catalog_slice(nth_slice)
+        name = "%03d" % nth_slice
         {
           "weight" => weight,
           "volume" => {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index