Class: Popper::Action::Base
- Inherits:
-
Object
- Object
- Popper::Action::Base
- Defined in:
- lib/popper/action/base.rb
Class Method Summary collapse
- .action(action = nil) ⇒ Object
- .action? ⇒ Boolean
- .check_params ⇒ Object
- .next_action(action = nil) ⇒ Object
- .next_run(config, mail, params = {}) ⇒ Object
- .run(config, mail, params = {}) ⇒ Object
Class Method Details
.action(action = nil) ⇒ Object
25 26 27 28 |
# File 'lib/popper/action/base.rb', line 25 def self.action(action=nil) @action = action if action @action end |
.action? ⇒ Boolean
34 35 36 |
# File 'lib/popper/action/base.rb', line 34 def self.action? @action_config && check_params end |
.check_params ⇒ Object
37 |
# File 'lib/popper/action/base.rb', line 37 def self.check_params; end |
.next_action(action = nil) ⇒ Object
20 21 22 23 |
# File 'lib/popper/action/base.rb', line 20 def self.next_action(action=nil) @next_action = action if action @next_action end |
.next_run(config, mail, params = {}) ⇒ Object
30 31 32 |
# File 'lib/popper/action/base.rb', line 30 def self.next_run(config, mail, params={}) @next_action.run(config, mail, params) if @next_action end |
.run(config, mail, params = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/popper/action/base.rb', line 7 def self.run(config, mail, params={}) @action_config = config.send(self.action) if config.respond_to?(self.action) begin Popper.log.info "run action #{self.action}" params = task(mail, params) Popper.log.info "exit action #{self.action}" rescue => e Popper.log.warn e Popper.log.warn e.backtrace end if action? next_run(config, mail, params) end |