Class TMail::MhMailbox
In: lib/tmail/mailbox.rb
lib/tmail/obsolete.rb
Parent: Object

mbox.rb

Methods

Constants

PORT_CLASS = MhPort

Attributes

last_atime  [RW] 

Public Class methods

[Source]

# 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

Public Instance methods

[Source]

# File lib/tmail/mailbox.rb, line 42
    def close
    end

[Source]

# File lib/tmail/mailbox.rb, line 30
    def directory
      @dirname
    end
dirname()

Alias for directory

each()

Alias for each_port

each_mail()

Alias for each_port

 Old #each_mail returns Port, we cannot define this method now.

def each_mail

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

end

[Source]

# 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
each_newmail(mtime = nil, &block)

Alias for each_new_port

[Source]

# 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

[Source]

# File lib/tmail/mailbox.rb, line 38
    def inspect
      "#<#{self.class} #{@dirname}>"
    end
new_mail()

Alias for new_port

[Source]

# File lib/tmail/mailbox.rb, line 45
    def new_port
      PORT_CLASS.new(next_file_name(@dirname))
    end
reverse_each()

Alias for reverse_each_port

[Source]

# File lib/tmail/mailbox.rb, line 58
    def reverse_each_port
      sorted_mail_entries(@dirname).reverse_each do |ent|
        yield PORT_CLASS.new("#{@dirname}/#{ent}")
      end
      @last_atime = Time.now
    end

[Validate]