Class: Patriot::Command::PostProcessor::Base
- Inherits:
-
Object
- Object
- Patriot::Command::PostProcessor::Base
- Defined in:
- lib/patriot/command/post_processor/base.rb
Overview
The base class of every post processor
Direct Known Subclasses
DiscardOnFail, HttpNotification, MailNotification, Retrial, SkipOnFail, SlackNotification
Instance Attribute Summary collapse
-
#props ⇒ Object
Returns the value of attribute props.
Class Method Summary collapse
-
.declare_post_processor_name(mth_name, parent_cls = Patriot::Command::Base, processor_cls = self) ⇒ Object
declare DSL method name for adding a post processor.
Instance Method Summary collapse
-
#initialize(props = {}) ⇒ Base
constructor
A new instance of Base.
- #process(cmd, worker, job_ticket) ⇒ Object
- #process_failure(cmd, worker, job_ticket) ⇒ Object
- #process_success(cmd, worker, job_ticket) ⇒ Object
- #validate_props(props) ⇒ Object
Constructor Details
#initialize(props = {}) ⇒ Base
Returns a new instance of Base.
24 25 26 27 28 |
# File 'lib/patriot/command/post_processor/base.rb', line 24 def initialize(props = {}) @props = {} props.each{|k,v| @props[k.to_sym] = v} validate_props(@props) end |
Instance Attribute Details
#props ⇒ Object
Returns the value of attribute props.
21 22 23 |
# File 'lib/patriot/command/post_processor/base.rb', line 21 def props @props end |
Class Method Details
.declare_post_processor_name(mth_name, parent_cls = Patriot::Command::Base, processor_cls = self) ⇒ Object
declare DSL method name for adding a post processor
12 13 14 15 16 17 18 19 |
# File 'lib/patriot/command/post_processor/base.rb', line 12 def self.declare_post_processor_name(mth_name, parent_cls=Patriot::Command::Base, processor_cls=self) parent_cls.class_eval do define_method(mth_name) do |processor_props = {}| pp = processor_cls.new(processor_props) add_post_processor(pp) end end end |
Instance Method Details
#process(cmd, worker, job_ticket) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/patriot/command/post_processor/base.rb', line 33 def process(cmd, worker, job_ticket) case job_ticket.exit_code when Patriot::Command::ExitCode::SUCCEEDED then return process_success(cmd, worker, job_ticket) when Patriot::Command::ExitCode::FAILED then return process_failure(cmd, worker, job_ticket) end return true end |
#process_failure(cmd, worker, job_ticket) ⇒ Object
45 46 47 |
# File 'lib/patriot/command/post_processor/base.rb', line 45 def process_failure(cmd, worker, job_ticket) return true end |
#process_success(cmd, worker, job_ticket) ⇒ Object
41 42 43 |
# File 'lib/patriot/command/post_processor/base.rb', line 41 def process_success(cmd, worker, job_ticket) return true end |
#validate_props(props) ⇒ Object
30 31 |
# File 'lib/patriot/command/post_processor/base.rb', line 30 def validate_props(props) end |