Class: Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/graphql/loaders/batch_project_statistics_loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject (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

#findObject


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