Class: Afterparty::MailerJob
- Inherits:
-
Object
- Object
- Afterparty::MailerJob
- Defined in:
- lib/afterparty/jobs.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#clazz ⇒ Object
Returns the value of attribute clazz.
-
#execute_at ⇒ Object
Returns the value of attribute execute_at.
-
#mail ⇒ Object
Returns the value of attribute mail.
-
#method ⇒ Object
Returns the value of attribute method.
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(clazz, method, *args) ⇒ MailerJob
constructor
A new instance of MailerJob.
- #run ⇒ Object
Constructor Details
#initialize(clazz, method, *args) ⇒ MailerJob
Returns a new instance of MailerJob.
4 5 6 7 8 9 |
# File 'lib/afterparty/jobs.rb', line 4 def initialize clazz, method, *args # @mail = UserMailer.welcome_email(User.find(1)) @clazz = UserMailer @method = method @args = args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
3 4 5 |
# File 'lib/afterparty/jobs.rb', line 3 def args @args end |
#clazz ⇒ Object
Returns the value of attribute clazz.
3 4 5 |
# File 'lib/afterparty/jobs.rb', line 3 def clazz @clazz end |
#execute_at ⇒ Object
Returns the value of attribute execute_at.
3 4 5 |
# File 'lib/afterparty/jobs.rb', line 3 def execute_at @execute_at end |
#mail ⇒ Object
Returns the value of attribute mail.
3 4 5 |
# File 'lib/afterparty/jobs.rb', line 3 def mail @mail end |
#method ⇒ Object
Returns the value of attribute method.
3 4 5 |
# File 'lib/afterparty/jobs.rb', line 3 def method @method end |
Instance Method Details
#description ⇒ Object
16 17 18 19 20 |
# File 'lib/afterparty/jobs.rb', line 16 def description desc = "Mailer: #{(@clazz || "nil")}." desc << "Method: #{(@method || nil)}." desc << "Args: #{(@args || nil)}" end |
#run ⇒ Object
11 12 13 14 |
# File 'lib/afterparty/jobs.rb', line 11 def run @mail = @clazz.send @method, *@args @mail.deliver end |