[Groonga-commit] ranguba/chupa-text at 6ff1a5f [master] Add Extractor#apply_configuration

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jan 3 23:22:32 JST 2014


Kouhei Sutou	2014-01-03 23:22:32 +0900 (Fri, 03 Jan 2014)

  New Revision: 6ff1a5f940e360db50a4f13596fcdc977c3ba82c
  https://github.com/ranguba/chupa-text/commit/6ff1a5f940e360db50a4f13596fcdc977c3ba82c

  Message:
    Add Extractor#apply_configuration

  Modified files:
    lib/chupa-text/command/chupa-text.rb
    lib/chupa-text/extractor.rb

  Modified: lib/chupa-text/command/chupa-text.rb (+1 -5)
===================================================================
--- lib/chupa-text/command/chupa-text.rb    2014-01-03 23:21:50 +0900 (babca2c)
+++ lib/chupa-text/command/chupa-text.rb    2014-01-03 23:22:32 +0900 (675e610)
@@ -84,11 +84,7 @@ module ChupaText
       def create_extractor
         Decomposers.load
         extractor = Extractor.new
-        decomposers = Decomposers.create(Decomposer.registry,
-                                         @configuration.decomposer)
-        decomposers.each do |decomposer|
-          extractor.add_decomposer(decomposer)
-        end
+        extractor.apply_configuration(@configuration)
         extractor
       end
 

  Modified: lib/chupa-text/extractor.rb (+15 -0)
===================================================================
--- lib/chupa-text/extractor.rb    2014-01-03 23:21:50 +0900 (68e37bd)
+++ lib/chupa-text/extractor.rb    2014-01-03 23:22:32 +0900 (52e6f15)
@@ -20,6 +20,21 @@ module ChupaText
       @decomposers = []
     end
 
+    # Sets the extractor up by the configuration. It adds decomposers
+    # enabled in the configuration.
+    #
+    # @param [Configuration] configuration The configuration to be
+    #   applied.
+    #
+    # @return [void]
+    def apply_configuration(configuration)
+      decomposers = Decomposers.create(Decomposer.registry,
+                                       configuration.decomposer)
+      decomposers.each do |decomposer|
+        add_decomposer(decomposer)
+      end
+    end
+
     def add_decomposer(decomposer)
       @decomposers << decomposer
     end
-------------- next part --------------
HTML����������������������������...
Download 



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