Class: Tape::Adapters::ActionMailer::ActiveRecord

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

Overview

For ActionMailer with delivery_method = :activerecord

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ActiveRecord

Returns a new instance of ActiveRecord.



10
11
12
13
14
15
16
17
# File 'lib/tape/adapters/action_mailer/active_record.rb', line 10

def initialize(options)
  super options

  # Default to Email if no model is configured.
  unless self.options[:model]
    self.options[:model] if const_defined?(Email)
  end
end

Instance Method Details

#allObject



19
20
21
# File 'lib/tape/adapters/action_mailer/active_record.rb', line 19

def all
  model.all.map { |email| parse email.mail }
end

#lastObject



23
24
25
26
27
# File 'lib/tape/adapters/action_mailer/active_record.rb', line 23

def last
  if email = model.last
    parse mail
  end
end

#resetObject



29
30
31
# File 'lib/tape/adapters/action_mailer/active_record.rb', line 29

def reset
  model.delete_all
end