mbox.rb

Methods
Constants
PORT_CLASS = MhPort
Attributes
[RW] last_atime
Public Class methods
new( dir )
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 31
31:     def initialize( dir )
32:       edir = File.expand_path(dir)
33:       raise ArgumentError, "not directory: #{dir}"\
34:                               unless FileTest.directory? edir
35:       @dirname = edir
36:       @last_file = nil
37:       @last_atime = nil
38:     end
Public Instance methods
close()
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 52
52:     def close
53:     end
directory()
This method is also aliased as dirname
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 40
40:     def directory
41:       @dirname
42:     end
dirname()

Alias for directory

each()

Alias for each_port

each_mail()

Alias for each_port

each_new_port( mtime = nil ) {|PORT_CLASS.new(path) if File.mtime(path) > mtime| ...}
 old #each_mail returns Port

def each_mail

  each_port do |port|
    yield Mail.new(port)
  end

end

This method is also aliased as each_newmail
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 84
84:     def each_new_port( mtime = nil, &block )
85:       mtime ||= @last_atime
86:       return each_port(&block) unless mtime
87:       return unless File.mtime(@dirname) >= mtime
88: 
89:       mail_files().each do |path|
90:         yield PORT_CLASS.new(path) if File.mtime(path) > mtime
91:       end
92:       @last_atime = Time.now
93:     end
each_newmail( mtime = nil, &block )

Alias for each_new_port

each_port() {|PORT_CLASS.new(path)| ...}
This method is also aliased as each each_mail
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 59
59:     def each_port
60:       mail_files().each do |path|
61:         yield PORT_CLASS.new(path)
62:       end
63:       @last_atime = Time.now
64:     end
inspect()
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 48
48:     def inspect
49:       "#<#{self.class} #{@dirname}>"
50:     end
new_mail()

Alias for new_port

new_port()
This method is also aliased as new_mail
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 55
55:     def new_port
56:       PORT_CLASS.new(next_file_name())
57:     end
reverse_each()

Alias for reverse_each_port

reverse_each_port() {|PORT_CLASS.new(path)| ...}
This method is also aliased as reverse_each
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 68
68:     def reverse_each_port
69:       mail_files().reverse_each do |path|
70:         yield PORT_CLASS.new(path)
71:       end
72:       @last_atime = Time.now
73:     end
Private Instance methods
mail_files()
     # File lib/action_mailer/vendor/tmail/mailbox.rb, line 97
 97:     def mail_files
 98:       Dir.entries(@dirname)\
 99:               .select {|s| /\A\d+\z/ === s }\
100:               .map {|s| s.to_i }\
101:               .sort\
102:               .map {|i| "#{@dirname}/#{i}" }\
103:               .select {|path| FileTest.file? path }
104:     end
next_file_name()
     # File lib/action_mailer/vendor/tmail/mailbox.rb, line 106
106:     def next_file_name
107:       unless n = @last_file
108:         n = 0
109:         Dir.entries(@dirname)\
110:                 .select {|s| /\A\d+\z/ === s }\
111:                 .map {|s| s.to_i }.sort\
112:         .each do |i|
113:           next unless FileTest.file? "#{@dirname}/#{i}"
114:           n = i
115:         end
116:       end
117:       begin
118:         n += 1
119:       end while FileTest.exist? "#{@dirname}/#{n}"
120:       @last_file = n
121: 
122:       "#{@dirname}/#{n}"
123:     end