[Groonga-commit] droonga/fluent-plugin-droonga at a4dc68e [master] Check element requirements in format method

Back to archive index

Yoji Shidara null+****@clear*****
Thu Dec 19 18:21:18 JST 2013


Yoji Shidara	2013-12-19 18:21:18 +0900 (Thu, 19 Dec 2013)

  New Revision: a4dc68e7aa365d90700d0be30b611c9786071e5b
  https://github.com/droonga/fluent-plugin-droonga/commit/a4dc68e7aa365d90700d0be30b611c9786071e5b

  Message:
    Check element requirements in format method

  Modified files:
    lib/droonga/searcher.rb

  Modified: lib/droonga/searcher.rb (+15 -8)
===================================================================
--- lib/droonga/searcher.rb    2013-12-19 18:12:52 +0900 (d34807b)
+++ lib/droonga/searcher.rb    2013-12-19 18:21:18 +0900 (9362885)
@@ -338,15 +338,27 @@ module Droonga
 
       def format
         formatted_result = {}
-        format_count(formatted_result)
-        format_attributes(formatted_result)
-        format_records(formatted_result)
+
+        if need_element_output?("count")
+          format_count(formatted_result)
+        end
+
+        if need_element_output?("attributes")
+          format_attributes(formatted_result)
+        end
+
+        if need_element_output?("records")
+          format_records(formatted_result)
+        end
+
         if need_element_output?("startTime")
           formatted_result["startTime"] =****@resul*****_time.iso8601
         end
+
         if need_element_output?("elapsedTime")
           formatted_result["elapsedTime"] =****@resul*****_time.to_f -****@resul*****_time.to_f
         end
+
         formatted_result
       end
 
@@ -361,13 +373,10 @@ module Droonga
       end
 
       def format_count(formatted_result)
-        return unless need_element_output?("count")
         formatted_result["count"] =****@resul*****
       end
 
       def format_attributes(formatted_result)
-        return unless need_element_output?("attributes")
-
         # XXX IMPLEMENT ME!!!
         attributes = nil
         if****@reque*****_output?
@@ -384,8 +393,6 @@ module Droonga
       end
 
       def format_records(formatted_result)
-        return unless need_element_output?("records")
-
         params =****@reque*****
 
         attributes = params["attributes"]
-------------- next part --------------
HTML����������������������������...
Download 



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