Kouhei Sutou
null+****@clear*****
Sun Feb 19 00:47:44 JST 2017
Kouhei Sutou 2017-02-19 00:47:44 +0900 (Sun, 19 Feb 2017) New Revision: 35feffa495a1812e662f1650b167ad4fcb55cbae https://github.com/ranguba/chupa-text-decomposer-mail/commit/35feffa495a1812e662f1650b167ad4fcb55cbae Message: Support Message-Id Modified files: lib/chupa-text/decomposers/mail.rb test/fixture/attributes.eml test/test-mail.rb Modified: lib/chupa-text/decomposers/mail.rb (+5 -5) =================================================================== --- lib/chupa-text/decomposers/mail.rb 2017-02-19 00:44:48 +0900 (91b2741) +++ lib/chupa-text/decomposers/mail.rb 2017-02-19 00:47:44 +0900 (4c42424) @@ -55,19 +55,19 @@ module ChupaText private def decompose_attributes(mail, data) - data[:subject] = mail.subject + data["message-id"] = mail.message_id + data["subject"] = mail.subject + data["date"] = mail.date from = mail[:from] if from - data[:from] = from.formatted | from.addresses + data["from"] = from.formatted | from.addresses end to = mail[:to] if to - data[:to] = to.formatted | to.addresses + data["to"] = to.formatted | to.addresses end - - data[:date] = mail.date end end end Modified: test/fixture/attributes.eml (+1 -0) =================================================================== --- test/fixture/attributes.eml 2017-02-19 00:44:48 +0900 (b51888d) +++ test/fixture/attributes.eml 2017-02-19 00:47:44 +0900 (2395b88) @@ -3,5 +3,6 @@ Subject: Hello From: Sender <from �� example.com> To: Recipient1 <to1 �� example.com>, Recipient2 <to2 �� example.com> Date: Sun, 19 Feb 2017 00:27:55 +0900 (JST) +Message-Id: <20170219.002755.448326596437930905 �� example.com> World Modified: test/test-mail.rb (+5 -0) =================================================================== --- test/test-mail.rb 2017-02-19 00:44:48 +0900 (41eb2ef) +++ test/test-mail.rb 2017-02-19 00:47:44 +0900 (7b72e4d) @@ -117,6 +117,11 @@ class TestMail < Test::Unit::TestCase decompose("date")) end + def test_message_id + assert_equal(["20170219.002755.448326596437930905 �� example.com"], + decompose("message-id")) + end + private def decompose(attribute_name) super(fixture_path("attributes.eml")).collect do |data| -------------- next part -------------- HTML����������������������������...下载