Class: Burner::Job
- Inherits:
-
Object
- Object
- Burner::Job
- Includes:
- Util::Arrayable
- Defined in:
- lib/burner/job.rb
Overview
Direct Known Subclasses
JobWithRegister, Library::Collection::Concatenate, Library::Echo, Library::IO::Exist, Library::Nothing, Library::Sleep, Library::Value::Copy
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name: '') ⇒ Job
constructor
A new instance of Job.
-
#perform(output, _payload) ⇒ Object
There are only a few requirements to be considered a valid Burner Job: 1.
Methods included from Util::Arrayable
Constructor Details
#initialize(name: '') ⇒ Job
Returns a new instance of Job.
21 22 23 |
# File 'lib/burner/job.rb', line 21 def initialize(name: '') @name = name.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/burner/job.rb', line 19 def name @name end |
Instance Method Details
#perform(output, _payload) ⇒ Object
There are only a few requirements to be considered a valid Burner Job:
1. The class responds to #name
2. The class responds to #perform(output, payload)
The #perform method takes in two arguments: output (an instance of Burner::Output) and payload (an instance of Burner::Payload). Jobs can leverage output to emit information to the pipeline’s log(s). The payload is utilized to pass data from job to job, with its most important attribute being #registers. The registers attribute is a mutable and accessible hash per the individual job’s context (meaning of it is unknown without understanding a job’s input and output value of #registers.). Therefore #register key values can mean anything and it is up to consumers to clearly document the assumptions of its use.
Returning false will short-circuit the pipeline right after the job method exits. Returning anything else besides false just means “continue”.
40 41 42 43 44 |
# File 'lib/burner/job.rb', line 40 def perform(output, _payload) output.detail("#perform not implemented for: #{self.class.name}") nil end |