From: Herve Saint-Amand Date: Sat, 28 Jan 2017 23:27:04 +0000 (+0000) Subject: Use each_with_object and make the code pithier X-Git-Tag: live~3723^2~1 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/74e28f8bd096cd9a00e96072a83bfef14cf10525?hp=a371aad9ac2f177eee761e8c0bfb0d358796373f Use each_with_object and make the code pithier --- 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