Module: DerivativeRodeo::Generators::HocrGenerator::RequiresExistingFile

Included in:
AltoGenerator, PlainTextGenerator, WordCoordinatesGenerator
Defined in:
lib/derivative_rodeo/generators/hocr_generator.rb

Overview

A mixin for generators that rely on hocr files.

Instance Method Summary collapse

Instance Method Details

#with_each_requisite_location_and_tmp_file_path(builder: HocrGenerator) {|file, tmp_path| ... } ⇒ Object

When a generator depends on a hocr file, this method will ensure that we have the requisite hocr file.

Parameters:

Yield Parameters:

See Also:



127
128
129
130
131
132
133
134
135
# File 'lib/derivative_rodeo/generators/hocr_generator.rb', line 127

def with_each_requisite_location_and_tmp_file_path(builder: HocrGenerator)
  prereq_output_location_template = Services::ConvertUriViaTemplateService.coerce_pre_requisite_template_from(template: output_location_template)
  requisite_files ||= builder.new(input_uris: input_uris, output_location_template: prereq_output_location_template).generated_files
  requisite_files.each do |input_location|
    input_location.with_existing_tmp_path do |tmp_file_path|
      yield(input_location, tmp_file_path)
    end
  end
end