From 74e28f8bd096cd9a00e96072a83bfef14cf10525 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Sat, 28 Jan 2017 23:27:04 +0000 Subject: [PATCH 1/1] Use each_with_object and make the code pithier --- test/test_helper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 68b4a5018..52d11027f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -187,15 +187,13 @@ module ActiveSupport end def email_text_parts(message) - text_parts = [] - message.parts.each do |part| + message.parts.each_with_object([]) do |part, text_parts| if part.content_type.start_with?("text/") text_parts.push(part) elsif part.multipart? text_parts.concat(email_text_parts(part)) end end - text_parts end end end -- 2.45.1