method
sort_parts
sort_parts(parts, order = [])
private
Hide source
# File actionmailer/lib/action_mailer/base.rb, line 605 def sort_parts(parts, order = []) order = order.collect { |s| s.downcase } parts = parts.sort do |a, b| a_ct = a.content_type.downcase b_ct = b.content_type.downcase a_in = order.include? a_ct b_in = order.include? b_ct s = case when a_in && b_in order.index(a_ct) <=> order.index(b_ct) when a_in -1 when b_in 1 else a_ct <=> b_ct end # reverse the ordering because parts that come last are displayed # first in mail clients (s * -1) end parts end