Class: Rudder::DSL::Job
Overview
Concourse job
Defines a plan of work that may share state in an explicit manner.
DSL Usage:
Job are defined by a name
and a
plan
of work.
Instance Method Summary collapse
- #_inner_hash ⇒ Object
-
#initialize(name) ⇒ Job
constructor
All Jobs require:.
-
#to_h ⇒ Hash
YAML friendly
Hash
representation of this resource.
Methods inherited from Component
#method_missing, #respond_to?, #respond_to_missing?
Methods included from Util
Constructor Details
#initialize(name) ⇒ Job
All Jobs require:
-
A name
-
A plan of work
Plans are defined after initialization
42 43 44 45 46 |
# File 'lib/rudder/dsl/job.rb', line 42 def initialize(name) raise super.ArgumentError 'Name cannot be nil' if name.nil? @job = { name: name, plan: [] } end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rudder::DSL::Component
Instance Method Details
#_inner_hash ⇒ Object
48 49 50 |
# File 'lib/rudder/dsl/job.rb', line 48 def _inner_hash @job end |
#to_h ⇒ Hash
Returns YAML friendly Hash
representation of this resource
57 58 59 60 61 62 |
# File 'lib/rudder/dsl/job.rb', line 57 def to_h raise 'Name must be set for Concourse Jobs' if @job[:name].nil? raise 'Plan must be set for Concourse Jobs' if @job[:plan].empty? super.to_h end |