[Groonga-commit] droonga/droonga-engine at eda4662 [master] Accept raw Ruby objects as an output message.

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed May 14 17:52:51 JST 2014


YUKI Hiroshi	2014-05-14 17:52:51 +0900 (Wed, 14 May 2014)

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

  Message:
    Accept raw Ruby objects as an output message.
    
    The output message can include raw Ruby object, Time, if there is no worker.

  Modified files:
    lib/droonga/plugins/groonga/select.rb

  Modified: lib/droonga/plugins/groonga/select.rb (+7 -5)
===================================================================
--- lib/droonga/plugins/groonga/select.rb    2014-05-14 16:08:54 +0900 (c0fd755)
+++ lib/droonga/plugins/groonga/select.rb    2014-05-14 17:52:51 +0900 (ee86bfc)
@@ -177,16 +177,18 @@ module Droonga
           def convert_main_result(result)
             status_code = 0
             start_time = result["startTime"]
-            start_time_in_unix_time = if start_time
-                                        Time.parse(start_time).to_f
-                                      else
-                                        Time.now.to_f
-                                      end
+            start_time_in_unix_time = normalize_time(start_time).to_f
             elapsed_time = result["elapsedTime"] || 0
             @header = [status_code, start_time_in_unix_time, elapsed_time]
             @body = convert_search_result(result)
           end
 
+          def normalize_time(time)
+            time ||= Time.now
+            time = Time.parse(time) if time.is_a?(String)
+            time
+          end
+
           def convert_drilldown_result(key, result)
             @drilldown_results << convert_search_result(result)
           end
-------------- next part --------------
HTML����������������������������...
Download 



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