[Groonga-commit] ranguba/chupa-text-decomposer-pdf at bb2d7fa [master] Reduce memory usage on target?

Back to archive index
Kouhei Sutou null+****@clear*****
Sun Mar 3 05:46:51 JST 2019


Kouhei Sutou	2019-03-03 05:46:51 +0900 (Sun, 03 Mar 2019)

  Revision: bb2d7fae3dd0bad5aac3e0d3d7449229e2752e1a
  https://github.com/ranguba/chupa-text-decomposer-pdf/commit/bb2d7fae3dd0bad5aac3e0d3d7449229e2752e1a

  Message:
    Reduce memory usage on target?

  Modified files:
    chupa-text-decomposer-pdf.gemspec
    lib/chupa-text/decomposers/pdf.rb

  Modified: chupa-text-decomposer-pdf.gemspec (+2 -2)
===================================================================
--- chupa-text-decomposer-pdf.gemspec    2019-02-27 18:22:02 +0900 (46664bc)
+++ chupa-text-decomposer-pdf.gemspec    2019-03-03 05:46:51 +0900 (0f4dc9c)
@@ -1,6 +1,6 @@
 # -*- ruby -*-
 #
-# Copyright (C) 2013-2017  Kouhei Sutou <kou****@clear*****>
+# Copyright (C) 2013-2019  Kouhei Sutou <kou****@clear*****>
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
   spec.files += Dir.glob("doc/text/*")
   spec.files += Dir.glob("test/**/*")
 
-  spec.add_runtime_dependency("chupa-text", ">= 1.0.7")
+  spec.add_runtime_dependency("chupa-text", ">= 1.1.8")
   spec.add_runtime_dependency("poppler")
 
   spec.add_development_dependency("bundler")

  Modified: lib/chupa-text/decomposers/pdf.rb (+1 -3)
===================================================================
--- lib/chupa-text/decomposers/pdf.rb    2019-02-27 18:22:02 +0900 (eb8a542)
+++ lib/chupa-text/decomposers/pdf.rb    2019-03-03 05:46:51 +0900 (32b69e3)
@@ -27,11 +27,9 @@ module ChupaText
       def target?(data)
         return true if data.mime_type == "application/pdf"
 
-        return false if data.body.nil?
-
         case data.extension
         when nil, "pdf"
-          data.body.start_with?("%PDF-1")
+          (data.peek_body(6) || "").start_with?("%PDF-1")
         else
           false
         end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190303/b5ddec92/attachment-0001.html>


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