Class: BulkImports::Pipeline::ExtractedData

Inherits:
Object
  • Object
show all
Defined in:
lib/bulk_imports/pipeline/extracted_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data: nil, page_info: {}) ⇒ ExtractedData

Returns a new instance of ExtractedData.


8
9
10
11
# File 'lib/bulk_imports/pipeline/extracted_data.rb', line 8

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

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.


6
7
8
# File 'lib/bulk_imports/pipeline/extracted_data.rb', line 6

def data
  @data
end

Instance Method Details

#each(&block) ⇒ Object


24
25
26
# File 'lib/bulk_imports/pipeline/extracted_data.rb', line 24

def each(&block)
  data.each(&block)
end

#has_next_page?Boolean

Returns:

  • (Boolean)

13
14
15
16
17
18
# File 'lib/bulk_imports/pipeline/extracted_data.rb', line 13

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

#next_pageObject


20
21
22
# File 'lib/bulk_imports/pipeline/extracted_data.rb', line 20

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