W3cubDocs

/Ruby on Rails 7.0

module ActionMailer::Previews::ClassMethods

Public Instance Methods

register_preview_interceptor(interceptor) Show source
# File actionmailer/lib/action_mailer/preview.rb, line 42
def register_preview_interceptor(interceptor)
  preview_interceptor = interceptor_class_for(interceptor)

  unless preview_interceptors.include?(preview_interceptor)
    preview_interceptors << preview_interceptor
  end
end

Register an Interceptor which will be called before mail is previewed. Either a class or a string can be passed in as the Interceptor. If a string is passed in it will be constantized.

register_preview_interceptors(*interceptors) Show source
# File actionmailer/lib/action_mailer/preview.rb, line 30
def register_preview_interceptors(*interceptors)
  interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) }
end

Register one or more Interceptors which will be called before mail is previewed.

unregister_preview_interceptor(interceptor) Show source
# File actionmailer/lib/action_mailer/preview.rb, line 53
def unregister_preview_interceptor(interceptor)
  preview_interceptors.delete(interceptor_class_for(interceptor))
end

Unregister a previously registered Interceptor. Either a class or a string can be passed in as the Interceptor. If a string is passed in it will be constantized.

unregister_preview_interceptors(*interceptors) Show source
# File actionmailer/lib/action_mailer/preview.rb, line 35
def unregister_preview_interceptors(*interceptors)
  interceptors.flatten.compact.each { |interceptor| unregister_preview_interceptor(interceptor) }
end

Unregister one or more previously registered Interceptors.

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.