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 50
50:     def initialize( dir )
51:       edir = File.expand_path(dir)
52:       raise ArgumentError, "not directory: #{dir}"\
53:                               unless FileTest.directory? edir
54:       @dirname = edir
55:       @last_file = nil
56:       @last_atime = nil
57:     end
Public Instance methods
close()
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 71
71:     def close
72:     end
directory()
This method is also aliased as dirname
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 59
59:     def directory
60:       @dirname
61:     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 103
103:     def each_new_port( mtime = nil, &block )
104:       mtime ||= @last_atime
105:       return each_port(&block) unless mtime
106:       return unless File.mtime(@dirname) >= mtime
107: 
108:       mail_files().each do |path|
109:         yield PORT_CLASS.new(path) if File.mtime(path) > mtime
110:       end
111:       @last_atime = Time.now
112:     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 78
78:     def each_port
79:       mail_files().each do |path|
80:         yield PORT_CLASS.new(path)
81:       end
82:       @last_atime = Time.now
83:     end
inspect()
    # File lib/action_mailer/vendor/tmail/mailbox.rb, line 67
67:     def inspect
68:       "#<#{self.class} #{@dirname}>"
69:     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 74
74:     def new_port
75:       PORT_CLASS.new(next_file_name())
76:     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 87
87:     def reverse_each_port
88:       mail_files().reverse_each do |path|
89:         yield PORT_CLASS.new(path)
90:       end
91:       @last_atime = Time.now
92:     end
Private Instance methods
mail_files()
     # File lib/action_mailer/vendor/tmail/mailbox.rb, line 116
116:     def mail_files
117:       Dir.entries(@dirname)\
118:               .select {|s| /\A\d+\z/ === s }\
119:               .map {|s| s.to_i }\
120:               .sort\
121:               .map {|i| "#{@dirname}/#{i}" }\
122:               .select {|path| FileTest.file? path }
123:     end
next_file_name()
     # File lib/action_mailer/vendor/tmail/mailbox.rb, line 125
125:     def next_file_name
126:       unless n = @last_file
127:         n = 0
128:         Dir.entries(@dirname)\
129:                 .select {|s| /\A\d+\z/ === s }\
130:                 .map {|s| s.to_i }.sort\
131:         .each do |i|
132:           next unless FileTest.file? "#{@dirname}/#{i}"
133:           n = i
134:         end
135:       end
136:       begin
137:         n += 1
138:       end while FileTest.exist? "#{@dirname}/#{n}"
139:       @last_file = n
140: 
141:       "#{@dirname}/#{n}"
142:     end