Use each_with_object and make the code pithier
This commit is contained in:
parent
a371aad9ac
commit
74e28f8bd0
1 changed files with 1 additions and 3 deletions
|
@ -187,15 +187,13 @@ module ActiveSupport
|
||||||
end
|
end
|
||||||
|
|
||||||
def email_text_parts(message)
|
def email_text_parts(message)
|
||||||
text_parts = []
|
message.parts.each_with_object([]) do |part, text_parts|
|
||||||
message.parts.each do |part|
|
|
||||||
if part.content_type.start_with?("text/")
|
if part.content_type.start_with?("text/")
|
||||||
text_parts.push(part)
|
text_parts.push(part)
|
||||||
elsif part.multipart?
|
elsif part.multipart?
|
||||||
text_parts.concat(email_text_parts(part))
|
text_parts.concat(email_text_parts(part))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
text_parts
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue