class ActionMailer::Preview

def all

Returns all mailer preview classes
def all
  load_previews if descendants.empty?
  descendants
end

def call(email)

as they would if the mail was actually being delivered.
interceptors will be informed so that they can transform the message
Returns the mail object for the given email name. The registered preview
def call(email)
  preview = self.new
  message = preview.public_send(email)
  inform_preview_interceptors(message)
  message
end

def email_exists?(email)

Returns true if the email exists
def email_exists?(email)
  emails.include?(email)
end

def emails

Returns all of the available email previews
def emails
  public_instance_methods(false).map(&:to_s).sort
end

def exists?(preview)

Returns true if the preview exists
def exists?(preview)
  all.any?{ |p| p.preview_name == preview }
end

def find(preview)

Find a mailer preview by its underscored class name
def find(preview)
  all.find{ |p| p.preview_name == preview }
end

def inform_preview_interceptors(message) #:nodoc:

:nodoc:
def inform_preview_interceptors(message) #:nodoc:
  Base.preview_interceptors.each do |interceptor|
    interceptor.previewing_email(message)
  end
end

def load_previews #:nodoc:

:nodoc:
def load_previews #:nodoc:
  if preview_path
    Dir["#{preview_path}/**/*_preview.rb"].each{ |file| require_dependency file }
  end
end

def preview_name

Returns the underscored name of the mailer preview without the suffix
def preview_name
  name.sub(/Preview$/, '').underscore
end

def preview_path #:nodoc:

:nodoc:
def preview_path #:nodoc:
  Base.preview_path
end