Parent

Class Index [+]

Quicksearch

Mail::PartsList

Public Instance Methods

attachments() click to toggle source
   # File lib/mail/parts_list.rb, line 4
4:     def attachments
5:       Mail::AttachmentsList.new(self)
6:     end
collect() click to toggle source
    # File lib/mail/parts_list.rb, line 8
 8:     def collect
 9:       if block_given?
10:         ary = PartsList.new
11:         each { |o| ary << yield(o) }
12:         ary
13:       else
14:         to_a
15:       end
16:     end
Also aliased as: map
collect!() click to toggle source
    # File lib/mail/parts_list.rb, line 25
25:     def collect!
26:       raise NoMethodError, "#collect! is not defined, please call #collect and create a new PartsList"
27:     end
map() click to toggle source
Alias for: collect
map!() click to toggle source
    # File lib/mail/parts_list.rb, line 21
21:     def map!
22:       raise NoMethodError, "#map! is not defined, please call #collect and create a new PartsList"
23:     end
sort() click to toggle source
    # File lib/mail/parts_list.rb, line 29
29:     def sort
30:       self.class.new(super)
31:     end
sort!(order) click to toggle source
    # File lib/mail/parts_list.rb, line 33
33:     def sort!(order)
34:       sorted = self.sort do |a, b|
35:         # OK, 10000 is arbitrary... if anyone actually wants to explicitly sort 10000 parts of a
36:         # single email message... please show me a use case and I'll put more work into this method,
37:         # in the meantime, it works :)
38:         get_order_value(a, order) <=> get_order_value(b, order)
39:       end
40:       self.clear
41:       sorted.each { |p| self << p }
42:     end

Private Instance Methods

get_order_value(part, order) click to toggle source
    # File lib/mail/parts_list.rb, line 46
46:     def get_order_value(part, order)
47:       if part.respond_to?(:content_type)
48:         order.index(part[:content_type].string.downcase) || 10000
49:       else
50:         10000
51:       end
52:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.