Class: Gitlab::Ci::Pipeline::Seed::Build::ResourceGroup
- Inherits:
-
Gitlab::Ci::Pipeline::Seed::Base
- Object
- Gitlab::Ci::Pipeline::Seed::Base
- Gitlab::Ci::Pipeline::Seed::Build::ResourceGroup
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/pipeline/seed/build/resource_group.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#resource_group_key ⇒ Object
readonly
Returns the value of attribute resource_group_key.
Instance Method Summary collapse
-
#initialize(build, resource_group_key) ⇒ ResourceGroup
constructor
A new instance of ResourceGroup.
- #to_resource ⇒ Object
Methods included from Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods inherited from Gitlab::Ci::Pipeline::Seed::Base
#attributes, #errors, #included?
Constructor Details
#initialize(build, resource_group_key) ⇒ ResourceGroup
Returns a new instance of ResourceGroup.
13 14 15 16 |
# File 'lib/gitlab/ci/pipeline/seed/build/resource_group.rb', line 13 def initialize(build, resource_group_key) @build = build @resource_group_key = resource_group_key end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build
11 12 13 |
# File 'lib/gitlab/ci/pipeline/seed/build/resource_group.rb', line 11 def build @build end |
#resource_group_key ⇒ Object (readonly)
Returns the value of attribute resource_group_key
11 12 13 |
# File 'lib/gitlab/ci/pipeline/seed/build/resource_group.rb', line 11 def resource_group_key @resource_group_key end |
Instance Method Details
#to_resource ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/gitlab/ci/pipeline/seed/build/resource_group.rb', line 18 def to_resource return unless resource_group_key.present? resource_group = build.project.resource_groups .safe_find_or_create_by(key: ) resource_group if resource_group.persisted? end |