debian-mirror-gitlab/lib/bulk_imports/pipeline/extracted_data.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
565 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
module BulkImports
module Pipeline
class ExtractedData
attr_reader :data
def initialize(data: nil, page_info: {})
2021-09-04 01:27:46 +05:30
@data = data.is_a?(Enumerator) ? data : Array.wrap(data)
2021-03-11 19:13:27 +05:30
@page_info = page_info
end
def has_next_page?
2021-04-29 21:17:54 +05:30
Gitlab::Utils.to_boolean(
@page_info&.dig('has_next_page'),
default: false
)
2021-03-11 19:13:27 +05:30
end
def next_page
2021-04-29 21:17:54 +05:30
@page_info&.dig('next_page')
2021-03-11 19:13:27 +05:30
end
def each(&block)
data.each(&block)
end
end
end
end