[Groonga-commit] droonga/fluent-plugin-droonga at 2aa9178 [master] Use case/when instead of chain of if

Back to archive index

Yoji Shidara null+****@clear*****
Thu Dec 19 17:41:20 JST 2013


Yoji Shidara	2013-12-19 17:41:20 +0900 (Thu, 19 Dec 2013)

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

  Message:
    Use case/when instead of chain of if

  Modified files:
    lib/droonga/searcher.rb

  Modified: lib/droonga/searcher.rb (+4 -3)
===================================================================
--- lib/droonga/searcher.rb    2013-12-19 17:46:39 +0900 (b98d35d)
+++ lib/droonga/searcher.rb    2013-12-19 17:41:20 +0900 (85e817f)
@@ -158,9 +158,10 @@ module Droonga
 
       private
       def parse_condition(source, expression, condition)
-        if condition.is_a? String
+        case condition
+        when String
           expression.parse(condition, :syntax => :script)
-        elsif condition.is_a? Hash
+        when Hash
           options = {}
           if condition["matchTo"]
             matchTo = Groonga::Expression.new(context: @request.context)
@@ -201,7 +202,7 @@ module Droonga
           else
             raise "neither 'query' nor 'script' assigned in #{condition.inspect}"
           end
-        elsif condition.is_a? Array
+        when Array
           case condition[0]
           when "||"
             operator = Groonga::Operator::OR
-------------- next part --------------
HTML����������������������������...
Download 



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