Welcome to mirror list, hosted at ThFree Co, Russian Federation.

integration_list.rb « integrations « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ab03e5c0e0a687fcf450a6d80d484af39e07cf11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Integrations
  class IntegrationList
    def initialize(batch, integration_hash, association)
      @batch = batch
      @integration_hash = integration_hash
      @association = association
    end

    def to_array
      [Integration, columns, values]
    end

    private

    attr_reader :batch, :integration_hash, :association

    def columns
      integration_hash.keys << "#{association}_id"
    end

    def values
      batch.select(:id).map do |record|
        integration_hash.values << record.id
      end
    end
  end
end