Class: Gitlab::Ci::Pipeline::Seed::Environment

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/ci/pipeline/seed/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attributes, #errors, #included?

Constructor Details

#initialize(job) ⇒ Environment

Returns a new instance of Environment.


10
11
12
# File 'lib/gitlab/ci/pipeline/seed/environment.rb', line 10

def initialize(job)
  @job = job
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job


8
9
10
# File 'lib/gitlab/ci/pipeline/seed/environment.rb', line 8

def job
  @job
end

Instance Method Details

#to_resourceObject


14
15
16
17
# File 'lib/gitlab/ci/pipeline/seed/environment.rb', line 14

def to_resource
  job.project.environments
    .safe_find_or_create_by(name: expanded_environment_name)
end