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

extracted_data.rb « pipeline « bulk_imports « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e4640db08735ea843698755a3af78425ac579f8a (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
# frozen_string_literal: true

module BulkImports
  module Pipeline
    class ExtractedData
      attr_reader :data

      delegate :each, :each_with_index, to: :data

      def initialize(data: nil, page_info: {})
        @data = data.is_a?(Enumerator) ? data : Array.wrap(data)
        @page_info = page_info
      end

      def has_next_page?
        Gitlab::Utils.to_boolean(
          @page_info&.dig('has_next_page'),
          default: false
        )
      end

      def next_page
        @page_info&.dig('next_page')
      end
    end
  end
end