# frozen_string_literal: true module Crys class BatchBuilder def initialize(pages_db_manager:, output_dir:, image_dir:, builder_class:) @pages_db_manager = pages_db_manager @output_dir = output_dir @image_dir = image_dir @builder_class = builder_class end def build pages_db_manager.pages.each do |page| builder_class.new( file_path: page.source, output_dir: output_dir, image_dir: image_dir, pages_db_manager: pages_db_manager ).build puts "processed: #{page.filename}" end end private attr_reader :pages_db_manager, :output_dir, :image_dir, :builder_class end end