Class: ActionMailer::Callbacks::Callback
- Inherits:
-
Object
- Object
- ActionMailer::Callbacks::Callback
- Defined in:
- lib/actionmailer/callbacks/callback.rb
Overview
this object stores the callback data
Instance Attribute Summary collapse
-
#except ⇒ Object
Returns the value of attribute except.
-
#name ⇒ Object
Returns the value of attribute name.
-
#only ⇒ Object
Returns the value of attribute only.
Instance Method Summary collapse
-
#initialize(callback_name, opts = {}) ⇒ Callback
constructor
A new instance of Callback.
- #should_run?(mailer_method) ⇒ Boolean
Constructor Details
#initialize(callback_name, opts = {}) ⇒ Callback
Returns a new instance of Callback.
7 8 9 10 11 |
# File 'lib/actionmailer/callbacks/callback.rb', line 7 def initialize(callback_name, opts={}) @name = callback_name @only = Array.wrap(opts[:only]).map(&:to_s) @except = Array.wrap(opts[:except]).map(&:to_s) end |
Instance Attribute Details
#except ⇒ Object
Returns the value of attribute except.
5 6 7 |
# File 'lib/actionmailer/callbacks/callback.rb', line 5 def except @except end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/actionmailer/callbacks/callback.rb', line 5 def name @name end |
#only ⇒ Object
Returns the value of attribute only.
5 6 7 |
# File 'lib/actionmailer/callbacks/callback.rb', line 5 def only @only end |
Instance Method Details
#should_run?(mailer_method) ⇒ Boolean
13 14 15 16 17 18 19 |
# File 'lib/actionmailer/callbacks/callback.rb', line 13 def should_run?(mailer_method) if @only.present? @only.include?(mailer_method.to_s) else !@except.include?(mailer_method.to_s) end end |