summaryrefslogtreecommitdiff
path: root/app/models/service_list.rb
blob: 2a75567d5ffd3ba48a4bb4b4ebe034019a0acd53 (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
# frozen_string_literal: true

class ServiceList
  def initialize(batch_ids, service_hash)
    @batch_ids = batch_ids
    @service_hash = service_hash
  end

  def to_array
    [Service, columns, values]
  end

  private

  attr_reader :batch_ids, :service_hash

  def columns
    (service_hash.keys << 'project_id')
  end

  def values
    batch_ids.map do |project_id|
      (service_hash.values << project_id)
    end
  end
end