Class: Datanorm::Documents::Assemble

Inherits:
Object
  • Object
show all
Includes:
Calls, Logging
Defined in:
lib/datanorm/documents/assemble.rb

Overview

Yields every product found in the text files that the preprocessing generated.

Instance Method Summary collapse

Methods included from Logging

included

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/datanorm/documents/assemble.rb', line 13

def call
  return unless products_file.file?

  ::File.foreach(products_file) do |json|
    progress.increment!

    if yield_progress
      yield ::Datanorm::Documents::Assembles::Product.new(json:, workdir:), progress
    else
      yield ::Datanorm::Documents::Assembles::Product.new(json:, workdir:)
    end
  end
end