[Groonga-commit] ranguba/chupa-text at fa5a22e [master] Finish when target data is text/plain

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jan 5 15:00:03 JST 2014


Kouhei Sutou	2014-01-05 15:00:03 +0900 (Sun, 05 Jan 2014)

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

  Message:
    Finish when target data is text/plain

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

  Modified: lib/chupa-text/extractor.rb (+5 -4)
===================================================================
--- lib/chupa-text/extractor.rb    2014-01-05 14:57:52 +0900 (47c932b)
+++ lib/chupa-text/extractor.rb    2014-01-05 15:00:03 +0900 (7eae97d)
@@ -56,17 +56,18 @@ module ChupaText
     #
     # @return [void]
     def extract(input)
-      processed = {}
       targets = [ensure_data(input)]
       until targets.empty?
         target = targets.pop
+        if target.text_plain?
+          yield(target)
+          next
+        end
         decomposer = find_decomposer(target)
-        processed_key = [decomposer, target.extension, target.mime_type]
-        if decomposer.nil? or processed[processed_key]
+        if decomposer.nil?
           yield(target) if target.text?
           next
         end
-        processed[processed_key] = true
         decomposer.decompose(target) do |decomposed|
           targets.push(decomposed)
         end
-------------- next part --------------
HTML����������������������������...
Download 



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