class Postdoc::Batch

This module represents a batch. At times we want to render multiple PDF's in series and batching saves a lot of overhead by not restarting chrome over and over. Practical applications are “stitching” PDF's together to get around markup constraints in chrome or rendering a batch of reports all at once.

Public Class Methods

new(jobs: []) click to toggle source
# File lib/postdoc/batch.rb, line 11
def initialize(jobs: [])
  @jobs = jobs
end

Public Instance Methods

add_document(document, settings: {}) click to toggle source

Creates a job from a document and add to the jobs.

# File lib/postdoc/batch.rb, line 16
def add_document(document, settings: {})
  settings = PrintSettings.new(**settings)
  @jobs << Job.new(document, settings: settings)
end
add_job(job) click to toggle source
# File lib/postdoc/batch.rb, line 21
def add_job(job)
  @jobs << job
end
cleanup() click to toggle source
# File lib/postdoc/batch.rb, line 30
def cleanup
  @jobs.each(&:cleanup)
end
result(client) click to toggle source

returns the output of the config. Requires a {Postdoc::Client Client}

# File lib/postdoc/batch.rb, line 26
def result(client)
  @jobs.map { |job| job.result(client) }
end