Class: Ci::Group
- Inherits:
-
Object
- Object
- Ci::Group
- Includes:
- Gitlab::Utils::StrongMemoize, StaticModel
- Defined in:
- app/models/ci/group.rb
Overview
This domain model is a representation of a group of jobs that are related to each other, like `rspec 0 1`, `rspec 0 2`.
It is not persisted in the database.
Instance Attribute Summary collapse
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
Class Method Summary collapse
Instance Method Summary collapse
- #detailed_status(current_user) ⇒ Object
-
#initialize(project, stage, name:, jobs:) ⇒ Group
constructor
A new instance of Group.
- #status ⇒ Object
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods included from StaticModel
#==, #[], #destroyed?, #new_record?, #persisted?, #to_param
Constructor Details
#initialize(project, stage, name:, jobs:) ⇒ Group
Returns a new instance of Group.
18 19 20 21 22 23 |
# File 'app/models/ci/group.rb', line 18 def initialize(project, stage, name:, jobs:) @project = project @stage = stage @name = name @jobs = jobs end |
Instance Attribute Details
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs
14 15 16 |
# File 'app/models/ci/group.rb', line 14 def jobs @jobs end |
#name ⇒ Object (readonly)
Returns the value of attribute name
14 15 16 |
# File 'app/models/ci/group.rb', line 14 def name @name end |
#project ⇒ Object (readonly)
Returns the value of attribute project
14 15 16 |
# File 'app/models/ci/group.rb', line 14 def project @project end |
#stage ⇒ Object (readonly)
Returns the value of attribute stage
14 15 16 |
# File 'app/models/ci/group.rb', line 14 def stage @stage end |
Class Method Details
.fabricate(project, stage) ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/models/ci/group.rb', line 42 def self.fabricate(project, stage) stage.latest_statuses .sort_by(&:sortable_name).group_by(&:group_name) .map do |group_name, grouped_statuses| self.new(project, stage, name: group_name, jobs: grouped_statuses) end end |