Class | TMail::MhMailbox |
In: |
lib/tmail/mailbox.rb
lib/tmail/obsolete.rb |
Parent: | Object |
mbox.rb
PORT_CLASS | = | MhPort |
last_atime | [RW] |
# File lib/tmail/mailbox.rb, line 23 def initialize(dir) raise ArgumentError, "not directory: #{dir}" unless File.directory?(dir) @dirname = File.expand_path(dir) @last_file = nil @last_atime = nil end
Old #each_mail returns Port, we cannot define this method now.
def each_mail
each_port do |port| yield Mail.new(port) end
end
# File lib/tmail/mailbox.rb, line 74 def each_new_port(mtime = nil, &block) mtime ||= @last_atime return each_port(&block) unless mtime return unless File.mtime(@dirname) >= mtime sorted_mail_entries(@dirname).each do |ent| path = "#{@dirname}/#{ent}" yield PORT_CLASS.new(path) if File.mtime(path) > mtime end @last_atime = Time.now end
# File lib/tmail/mailbox.rb, line 49 def each_port sorted_mail_entries(@dirname).each do |ent| yield PORT_CLASS.new("#{@dirname}/#{ent}") end @last_atime = Time.now end