[Groonga-commit] droonga/droonga-engine at 8888f41 [master] dump: use predicate instead of is_a?

Back to archive index

Kouhei Sutou null+****@clear*****
Fri May 16 18:22:37 JST 2014


Kouhei Sutou	2014-05-16 18:22:37 +0900 (Fri, 16 May 2014)

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

  Message:
    dump: use predicate instead of is_a?

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

  Modified: lib/droonga/plugins/dump.rb (+13 -5)
===================================================================
--- lib/droonga/plugins/dump.rb    2014-05-16 18:03:52 +0900 (62b7c30)
+++ lib/droonga/plugins/dump.rb    2014-05-16 18:22:37 +0900 (2836d4c)
@@ -225,7 +225,7 @@ module Droonga
         end
 
         def column_type(column)
-          if column.is_a?(::Groonga::IndexColumn)
+          if index_column?(column)
             "Index"
           elsif column.vector?
             "Vector"
@@ -274,25 +274,33 @@ module Droonga
             :order_by => :key,
           }
           @context.database.each(options) do |object|
-            next unless object.is_a?(::Groonga::Table)
+            next unless table?(object)
             yield(object)
           end
         end
 
+        def table?(object)
+          object.is_a?(::Groonga::Table)
+        end
+
         def index_only_table?(table)
           table.columns.all? do |column|
-            column.is_a?(::Groonga::IndexColumn)
+            index_column?(column)
           end
         end
 
         def reference_table?(table)
-          table.support_key? and table.domain.is_a?(::Groonga::Table)
+          table.support_key? and table?(table.domain)
+        end
+
+        def index_column?(column)
+          column.is_a?(::Groonga::IndexColumn)
         end
 
         def each_index_columns
           each_table do |table|
             table.columns.each do |column|
-              yield(column) if column.is_a?(::Groonga::IndexColumn)
+              yield(column) if index_column?(column)
             end
           end
         end
-------------- next part --------------
HTML����������������������������...
Download 



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