class Patriot::Command::PostProcessor::Base
The base class of every post processor
Attributes
props[RW]
Public Class Methods
declare_post_processor_name(mth_name, parent_cls=Patriot::Command::Base, processor_cls=self)
click to toggle source
declare DSL method name for adding a post processor @param mth_name [String] the DSL method name @param parent_cls [Class<Patriot::Command::Base>] parent command in which the post porcessor is available @param processor_cls [Class<Patriot::Command::PostProcessor::Base] the class of the post processor
# 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
new(props = {})
click to toggle source
@param props [Hash] properties of this post processor
# 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
Public Instance Methods
process(cmd, worker, job_ticket)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# File lib/patriot/command/post_processor/base.rb, line 41 def process_success(cmd, worker, job_ticket) return true end
validate_props(props)
click to toggle source
# File lib/patriot/command/post_processor/base.rb, line 30 def validate_props(props) end