Class: Tape::Adapters::ActionMailer::Maildir

Inherits:
Base
  • Object
show all
Defined in:
lib/tape/adapters/action_mailer/maildir.rb

Overview

For ActionMailer with delivery_method = :maildir.

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#by_recipient, #parse

Constructor Details

#initialize(options = {}) ⇒ Maildir

Returns a new instance of Maildir.



12
13
14
15
16
# File 'lib/tape/adapters/action_mailer/maildir.rb', line 12

def initialize(options = {})
  super options
  @maildir = ::Maildir.new(options[:path])
  @maildir.serializer = ::Maildir::Serializer::Mail.new
end

Instance Method Details

#allObject



18
19
20
# File 'lib/tape/adapters/action_mailer/maildir.rb', line 18

def all
  @maildir.list(:new).collect(&:data)
end

#lastObject



22
23
24
25
# File 'lib/tape/adapters/action_mailer/maildir.rb', line 22

def last
  # FIXME: Sort by date
  all.last
end

#resetObject



27
28
29
30
31
# File 'lib/tape/adapters/action_mailer/maildir.rb', line 27

def reset
  @maildir.list(:new).each do |message|
    message.destroy
  end
end