Class: Burner::JobSet
- Inherits:
-
Object
- Object
- Burner::JobSet
- Defined in:
- lib/burner/job_set.rb
Overview
This class understands how jobs fit together as a cohesive unit. It does not know how to use them, but it knows how to group them together in a logical manner following some simple rules, such as:
- Jobs in a set should have unique names (unless the name is blank)
- Subsets of jobs can be extracted, by name, in constant time.
Defined Under Namespace
Classes: DuplicateJobNameError, JobNotFoundError
Instance Method Summary collapse
-
#initialize(jobs = []) ⇒ JobSet
constructor
A new instance of JobSet.
- #jobs(names = nil) ⇒ Object
Constructor Details
Instance Method Details
#jobs(names = nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/burner/job_set.rb', line 28 def jobs(names = nil) return @jobs unless names Array(names).map do |name| job = named_jobs_by_name[name.to_s] raise JobNotFoundError, "#{name} was not declared as a job" unless job job end end |