blob: 43dbec6255247dc9a2157f5df5d65b35cf56b099 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
module Crys
class BatchBuilder
def initialize(pages_db:, output_dir:, image_dir:, builder_class:)
@pages_db = pages_db
@output_dir = output_dir
@image_dir = image_dir
@builder_class = builder_class
end
def build
db.pages.each do |page|
builder_class.new(
file_path: page.file_path,
output_dir: output_dir,
image_dir: image_dir
).build
puts "processed: #{page.filename}"
end
end
private
attr_reader :pages_db, :output_dir, :image_dir, :builder_class
def db
pages_db.new
end
end
end
|