Class: Gitlab::PipelineScopeCounts
- Inherits:
-
Object
- Object
- Gitlab::PipelineScopeCounts
- Defined in:
- lib/gitlab/pipeline_scope_counts.rb
Constant Summary collapse
- PIPELINES_COUNT_LIMIT =
1000
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
- #finished ⇒ Object
-
#initialize(current_user, project, params) ⇒ PipelineScopeCounts
constructor
A new instance of PipelineScopeCounts.
- #pending ⇒ Object
- #running ⇒ Object
Constructor Details
#initialize(current_user, project, params) ⇒ PipelineScopeCounts
Returns a new instance of PipelineScopeCounts.
13 14 15 16 17 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 13 def initialize(current_user, project, params) @current_user = current_user @project = project @params = params end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
5 6 7 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 5 def project @project end |
Class Method Details
.declarative_policy_class ⇒ Object
9 10 11 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 9 def self.declarative_policy_class 'Ci::ProjectPipelinesPolicy' end |
Instance Method Details
#all ⇒ Object
19 20 21 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 19 def all finder.execute.limit(PIPELINES_COUNT_LIMIT).count end |
#finished ⇒ Object
27 28 29 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 27 def finished finder({ scope: "finished" }).execute.limit(PIPELINES_COUNT_LIMIT).count end |
#pending ⇒ Object
31 32 33 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 31 def pending finder({ scope: "pending" }).execute.limit(PIPELINES_COUNT_LIMIT).count end |
#running ⇒ Object
23 24 25 |
# File 'lib/gitlab/pipeline_scope_counts.rb', line 23 def running finder({ scope: "running" }).execute.limit(PIPELINES_COUNT_LIMIT).count end |