YUKI Hiroshi
null+****@clear*****
Tue Apr 14 12:19:31 JST 2015
YUKI Hiroshi 2015-04-14 12:19:31 +0900 (Tue, 14 Apr 2015) New Revision: a38f90c82a4c2a098dc9257f185bffe807cda60d https://github.com/droonga/droonga-engine/commit/a38f90c82a4c2a098dc9257f185bffe807cda60d Message: Fix indent Modified files: lib/droonga/plugins/system/absorb_data.rb Modified: lib/droonga/plugins/system/absorb_data.rb (+40 -42) =================================================================== --- lib/droonga/plugins/system/absorb_data.rb 2015-04-14 12:16:41 +0900 (fd825ac) +++ lib/droonga/plugins/system/absorb_data.rb 2015-04-14 12:19:31 +0900 (c00f6ff) @@ -182,22 +182,20 @@ module Droonga def get_source_tables(&block) source_client.request("dataset" => source_dataset, "type" => "table_list") do |response| + unless response + raise EmptyResponse.new("table_list returns nil response") + end + unless response["body"] + raise EmptyBody.new("table_list returns nil result") + end - unless response - raise EmptyResponse.new("table_list returns nil response") - end - unless response["body"] - raise EmptyBody.new("table_list returns nil result") - end - - message_body = response["body"] - body = message_body[1] - tables = body[1..-1] - table_names = tables.collect do |table| - table[1] - end - yield(table_names) - + message_body = response["body"] + body = message_body[1] + tables = body[1..-1] + table_names = tables.collect do |table| + table[1] + end + yield(table_names) end end @@ -224,34 +222,34 @@ module Droonga def get_total_n_source_records(&block) get_source_tables do |source_tables| - queries = {} - source_tables.each do |table| - queries["n_records_of_#{table}"] = { - "source" => table, - "output" => { - "elements" => ["count"], - }, - } - end - source_client.request("dataset" => source_dataset, - "type" => "search", - "body" => { - "timeout" => 10, - "queries" => queries, - }) do |response| - unless response - raise EmptyResponse.new("search returns nil response") - end - unless response["body"] - raise EmptyBody.new("search returns nil result") - end + queries = {} + source_tables.each do |table| + queries["n_records_of_#{table}"] = { + "source" => table, + "output" => { + "elements" => ["count"], + }, + } + end + source_client.request("dataset" => source_dataset, + "type" => "search", + "body" => { + "timeout" => 10, + "queries" => queries, + }) do |response| + unless response + raise EmptyResponse.new("search returns nil response") + end + unless response["body"] + raise EmptyBody.new("search returns nil result") + end - n_records = 0 - response["body"].each do |query_name, result| - n_records += result["count"] - end - yield(n_records) - end + n_records = 0 + response["body"].each do |query_name, result| + n_records += result["count"] + end + yield(n_records) + end end end -------------- next part -------------- HTML����������������������������... 다운로드