Class: Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader
- Inherits:
-
Object
- Object
- Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader
- Defined in:
- lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb
Instance Attribute Summary collapse
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(project_id) ⇒ BatchProjectStatisticsLoader
constructor
A new instance of BatchProjectStatisticsLoader.
Constructor Details
#initialize(project_id) ⇒ BatchProjectStatisticsLoader
Returns a new instance of BatchProjectStatisticsLoader.
9 10 11 |
# File 'lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb', line 9 def initialize(project_id) @project_id = project_id end |
Instance Attribute Details
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
7 8 9 |
# File 'lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb', line 7 def project_id @project_id end |
Instance Method Details
#find ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb', line 13 def find BatchLoader::GraphQL.for(project_id).batch do |project_ids, loader| ProjectStatistics.for_project_ids(project_ids).each do |statistics| loader.call(statistics.project_id, statistics) end end end |