Class: GOCD::PIPELINE_CONFIG::Environment

Inherits:
Object
  • Object
show all
Includes:
GOCD::PIPELINE_CONFIG
Defined in:
lib/gocd/pipeline_config/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GOCD::PIPELINE_CONFIG

#environments, #groups, #pipeline_config_response, #templates, #to_array

Constructor Details

#initialize(environment) ⇒ Environment

Returns a new instance of Environment.



9
10
11
12
# File 'lib/gocd/pipeline_config/environment.rb', line 9

def initialize(environment)
  @name = environment['@name']
  @pipeline_names = to_pipelines(environment["pipelines"] || {})
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/gocd/pipeline_config/environment.rb', line 7

def name
  @name
end

#pipeline_namesObject (readonly)

Returns the value of attribute pipeline_names.



7
8
9
# File 'lib/gocd/pipeline_config/environment.rb', line 7

def pipeline_names
  @pipeline_names
end

#pipelinesObject (readonly)

Returns the value of attribute pipelines.



7
8
9
# File 'lib/gocd/pipeline_config/environment.rb', line 7

def pipelines
  @pipelines
end

Instance Method Details

#enrich_with_pipelines(pipelines) ⇒ Object



18
19
20
21
# File 'lib/gocd/pipeline_config/environment.rb', line 18

def enrich_with_pipelines(pipelines)
  pipelines.each { |pipeline| pipeline.environment = name }
  @pipelines = pipelines
end

#has_pipeline?(pipeline) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/gocd/pipeline_config/environment.rb', line 14

def has_pipeline?(pipeline)
  pipelines.include? pipeline
end