Kouhei Sutou 2019-02-27 17:19:00 +0900 (Wed, 27 Feb 2019) Revision: a7cd09cdd7d69069ac1ee11e50f6ea0c22917d80 https://github.com/ranguba/chupa-text-decomposer-pdf/commit/a7cd09cdd7d69069ac1ee11e50f6ea0c22917d80 Message: path may be String Modified files: lib/chupa-text/decomposers/pdf.rb Modified: lib/chupa-text/decomposers/pdf.rb (+11 -3) =================================================================== --- lib/chupa-text/decomposers/pdf.rb 2019-02-27 17:15:25 +0900 (382fbe5) +++ lib/chupa-text/decomposers/pdf.rb 2019-02-27 17:19:00 +0900 (eb8a542) @@ -64,9 +64,17 @@ module ChupaText def create_document(data) _password = password(data) path = data.path - if path and path.exist? - path = path.to_s - else + case path + when String + path = nil unless File.exist?(path) + when Pathname + if path.exist? + path = path.to_s + else + path = nil + end + end + if path.nil? file = Tempfile.new(["chupa-text-decomposer-pdf", ".pdf"]) file.binmode file.write(data.body) -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190227/a8f97b29/attachment.html>