class ActionMailer::Preview

def all

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

def call(email, params = {})

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, params = {})
  preview = new(params)
  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)

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

def initialize(params = {})

def initialize(params = {})
  @params = params
end

def load_previews

def load_previews
  if preview_path
    Dir["#{preview_path}/**/*_preview.rb"].sort.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.delete_suffix("Preview").underscore
end

def preview_path

def preview_path
  Base.preview_path
end

def show_previews

def show_previews
  Base.show_previews
end