class Rudder::DSL::Job
Concourse job
Defines a plan of work that may share state in an explicit manner.
DSL
Usage:¶ ↑
{Rudder::DSL::Job} are defined by a name
and a plan
of work.
@example
# Name's are set during initializtion, and may not be nil job :awesome_job # => job.name = :awesome_job job nil # => Raises ArgumentError
@example
# The plan is set after construction job :awesome_job do plan << { get: :some_resource } plan << { get: :another_resource } end # => plan.source = [{get: :some_resource}, {get: :another_resource}]
Public Class Methods
new(name)
click to toggle source
All Jobs require:
-
A name
-
A plan of work
Plans are defined after initialization
@param name [String, Symbol] name of this Concourse job. Must not be nil
@raise [ArgumentError] when name
is nil
Calls superclass method
# 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
Public Instance Methods
_inner_hash()
click to toggle source
# File lib/rudder/dsl/job.rb, line 48 def _inner_hash @job end
to_h()
click to toggle source
@return [Hash] YAML friendly Hash
representation of this resource
@raise [RuntimeError] if name
is nil
or plan
is empty
Calls superclass method
Rudder::DSL::Component#to_h
# 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