]> git.openstreetmap.org Git - rails.git/blobdiff - test/test_helper.rb
Use each_with_object and make the code pithier
[rails.git] / test / test_helper.rb
index 68b4a5018ffe5c2ee47d40d1832c39589501afdd..52d11027f8fdc9d696e26a9aa54fa67cfbce07fb 100644 (file)
@@ -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