Module: ActionMailer::Previews::ClassMethods
- Defined in:
- actionmailer/lib/action_mailer/preview.rb
Instance Method Summary collapse
-
#register_preview_interceptor(interceptor) ⇒ Object
Register an Interceptor which will be called before mail is previewed.
-
#register_preview_interceptors(*interceptors) ⇒ Object
Register one or more Interceptors which will be called before mail is previewed.
Instance Method Details
#register_preview_interceptor(interceptor) ⇒ Object
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 constantize
d.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'actionmailer/lib/action_mailer/preview.rb', line 28 def register_preview_interceptor(interceptor) preview_interceptor = case interceptor when String, Symbol interceptor.to_s.camelize.constantize else interceptor end unless preview_interceptors.include?(preview_interceptor) preview_interceptors << preview_interceptor end end |
#register_preview_interceptors(*interceptors) ⇒ Object
Register one or more Interceptors which will be called before mail is previewed.
21 22 23 |
# File 'actionmailer/lib/action_mailer/preview.rb', line 21 def register_preview_interceptors(*interceptors) interceptors.flatten.compact.each { |interceptor| register_preview_interceptor(interceptor) } end |