Class: Gitlab::Ci::Pipeline::Seed::Processable::ResourceGroup
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/pipeline/seed/processable/resource_group.rb
Instance Attribute Summary collapse
-
#processable ⇒ Object
readonly
Returns the value of attribute processable.
-
#resource_group_key ⇒ Object
readonly
Returns the value of attribute resource_group_key.
Instance Method Summary collapse
-
#initialize(processable, resource_group_key) ⇒ ResourceGroup
constructor
A new instance of ResourceGroup.
- #to_resource ⇒ Object
Methods inherited from Base
#attributes, #errors, #included?
Constructor Details
#initialize(processable, resource_group_key) ⇒ ResourceGroup
Returns a new instance of ResourceGroup.
13 14 15 16 |
# File 'lib/gitlab/ci/pipeline/seed/processable/resource_group.rb', line 13 def initialize(processable, resource_group_key) @processable = processable @resource_group_key = resource_group_key end |
Instance Attribute Details
#processable ⇒ Object (readonly)
Returns the value of attribute processable.
11 12 13 |
# File 'lib/gitlab/ci/pipeline/seed/processable/resource_group.rb', line 11 def processable @processable end |
#resource_group_key ⇒ Object (readonly)
Returns the value of attribute resource_group_key.
11 12 13 |
# File 'lib/gitlab/ci/pipeline/seed/processable/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/processable/resource_group.rb', line 18 def to_resource return unless resource_group_key.present? resource_group = processable.project.resource_groups .safe_find_or_create_by(key: ) resource_group if resource_group.persisted? end |