[Groonga-commit] ranguba/rroonga at 16622f1 [master] groonga-database-inspector: show the number of sources

Back to archive index

Kouhei Sutou null+****@clear*****
Sun May 31 17:38:40 JST 2015


Kouhei Sutou	2015-05-31 17:38:40 +0900 (Sun, 31 May 2015)

  New Revision: 16622f11ce36308290e47ef5f17e8f84ac942ee6
  https://github.com/ranguba/rroonga/commit/16622f11ce36308290e47ef5f17e8f84ac942ee6

  Message:
    groonga-database-inspector: show the number of sources

  Modified files:
    lib/groonga/database-inspector.rb
    test/test-database-inspector.rb

  Modified: lib/groonga/database-inspector.rb (+9 -2)
===================================================================
--- lib/groonga/database-inspector.rb    2015-05-31 17:25:00 +0900 (05a47b8)
+++ lib/groonga/database-inspector.rb    2015-05-31 17:38:40 +0900 (d23a0a5)
@@ -159,8 +159,15 @@ module Groonga
           write("ID:         #{column.id}\n")
           write("Type:       #{inspect_column_type(column)}\n")
           if column.index?
-            column.sources.each do |source|
-              write("Source:     #{inspect_source(source)}\n")
+            sources = column.sources
+            write("N sources:  #{sources.size}\n")
+            unless sources.empty?
+              write("Sources:\n")
+              indent do
+                sources.each do |source|
+                  write("Name:     #{inspect_source(source)}\n")
+                end
+              end
             end
           else
             write("Value type: #{inspect_value_type(column.range)}\n")

  Modified: test/test-database-inspector.rb (+9 -5)
===================================================================
--- test/test-database-inspector.rb    2015-05-31 17:25:00 +0900 (cf95712)
+++ test/test-database-inspector.rb    2015-05-31 17:38:40 +0900 (f5042f9)
@@ -723,10 +723,13 @@ Database
 
       def inspected(type)
         if type == "index"
-          sources =****@colum***** do |source|
-            "  Source:     #{source.name}"
+          sources =****@colum*****
+          additional_info = "  N sources:  #{sources.size}\n"
+          additional_info << "  Sources:\n"
+          source_names = sources.collect do |source|
+            "    Name:     #{source.name}"
           end
-          additional_info = sources.join("\n")
+          additional_info << source_names.join("\n")
         else
           additional_info = "  Value type: #{@column.range.name}"
         end
@@ -761,9 +764,10 @@ Database
 
       private
       def inspected(source_names)
-        inspected_sources = ""
+        inspected_sources = "  N sources:  #{source_names.size}\n"
+        inspected_sources << "  Sources:\n"
         source_names.each do |source_name|
-          inspected_sources << "  Source:     #{source_name}\n"
+          inspected_sources << "    Name:     #{source_name}\n"
         end
         <<-INSPECTED
 #{@column.local_name}:
-------------- next part --------------
HTML����������������������������...
下载 



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