Methods
C
E
L
M
N
R
S
Class Public methods
create_from_line( port )

make _From line

# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 209
def UNIXMbox.create_from_line( port )
  sprintf 'From %s %s',
          fromaddr(), TextUtils.time2str(File.mtime(port.filename))
end
lock( fname )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 151
def UNIXMbox.lock( fname )
  begin
    f = File.open(fname)
    f.flock File::LOCK_EX
    yield f
  ensure
    f.flock File::LOCK_UN
    f.close if f and not f.closed?
  end
end
mkfinal( mh, mboxfile, writeback_p, cleanup_p )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 186
def UNIXMbox.mkfinal( mh, mboxfile, writeback_p, cleanup_p )
  lambda {
      if writeback_p
        lock(mboxfile) {|f|
            mh.each_port do |port|
              f.puts create_from_line(port)
              port.ropen {|r|
                  f.puts r.read
              }
            end
        }
      end
      if cleanup_p
        Dir.foreach(mh.dirname) do |fname|
          next if %r\A\.\.?\z/ === fname
          File.unlink "#{mh.dirname}/#{fname}"
        end
        Dir.rmdir mh.dirname
      end
  }
end
new( fname, tmpdir = nil, readonly = false )
Also aliased as: newobj
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 166
def UNIXMbox.new( fname, tmpdir = nil, readonly = false )
  tmpdir = ENV['TEMP'] || ENV['TMP'] || '/tmp'
  newobj(fname, "#{tmpdir}/ruby_tmail_#{$$}_#{rand()}", readonly, false)
end
new( fname, mhdir, readonly, static )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 175
def initialize( fname, mhdir, readonly, static )
  @filename = fname
  @readonly = readonly
  @closed = false

  Dir.mkdir mhdir
  @real = MhMailbox.new(mhdir)
  @finalizer = UNIXMbox.mkfinal(@real, @filename, !@readonly, !static)
  ObjectSpace.define_finalizer self, @finalizer
end
newobj( fname, tmpdir = nil, readonly = false )
static_new( fname, dir, readonly = false )
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 171
def UNIXMbox.static_new( fname, dir, readonly = false )
  newobj(fname, dir, readonly, true)
end
Instance Public methods
close()
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 222
def close
  return if @closed

  ObjectSpace.undefine_finalizer self
  @finalizer.call
  @finalizer = nil
  @real = nil
  @closed = true
  @updated = nil
end
each( &block )
each_mail( &block )
each_new_port( mtime = nil )
old #each_mail returns Port

def #each_mail( &block )

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

end

Also aliased as: each_newmail
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 256
def each_new_port( mtime = nil )
  close_check
  update
  @real.each_new_port(mtime) {|p| yield p }
end
each_newmail( mtime = nil )
each_port( &block )
Also aliased as: each, each_mail
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 233
def each_port( &block )
  close_check
  update
  @real.each_port(&block)
end
new_mail()
new_port()
Also aliased as: new_mail
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 262
def new_port
  close_check
  @real.new_port
end
reverse_each( &block )
reverse_each_port( &block )
Also aliased as: reverse_each
# File rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb, line 241
def reverse_each_port( &block )
  close_check
  update
  @real.reverse_each_port(&block)
end