[Groonga-commit] droonga/droonga-engine at 07e7995 [master] dump: extract as a method

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Thu May 15 17:53:11 JST 2014


Kouhei Sutou	2014-05-15 17:53:11 +0900 (Thu, 15 May 2014)

  New Revision: 07e7995d1d777fa0d2b9ce1d99c7e2433f7bb45c
  https://github.com/droonga/droonga-engine/commit/07e7995d1d777fa0d2b9ce1d99c7e2433f7bb45c

  Message:
    dump: extract as a method

  Modified files:
    lib/droonga/plugins/dump.rb

  Modified: lib/droonga/plugins/dump.rb (+18 -14)
===================================================================
--- lib/droonga/plugins/dump.rb    2014-05-15 17:48:46 +0900 (b7bbc8e)
+++ lib/droonga/plugins/dump.rb    2014-05-15 17:53:11 +0900 (e6bcf59)
@@ -82,20 +82,7 @@ module Droonga
           forward("dump.start")
 
           dumper = Fiber.new do
-            each_table do |table|
-              table.each do |record|
-                values = {}
-                record.attributes.each do |key, value|
-                  values[key] = value unless key.start_with?("_")
-                end
-                body = {
-                  "table" => table.name,
-                  "key" => record.key,
-                  "values" => values,
-                }
-                forward("dump.record", body)
-              end
-            end
+            dump_records
             forward("dump.end")
           end
 
@@ -136,6 +123,23 @@ module Droonga
           Fiber.yield if @n_forwarded_messages.zero?
         end
 
+        def dump_records
+          each_table do |table|
+            table.each do |record|
+              values = {}
+              record.attributes.each do |key, value|
+                values[key] = value unless key.start_with?("_")
+              end
+              body = {
+                "table" => table.name,
+                "key" => record.key,
+                "values" => values,
+              }
+              forward("dump.record", body)
+            end
+          end
+        end
+
         def each_table
           @context.database.each(:ignore_missing_object => true) do |object|
             next unless object.is_a?(::Groonga::Table)
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る