Method: Postdoc.batch

Defined in:
lib/postdoc.rb

.batch(batch: Batch.new) {|batch| ... } ⇒ Object

result = Postdoc.batch do |batch|

batch.add_document doc1
batch.add_document doc2, settings: with_footer

end “‘

Yields:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/postdoc.rb', line 41

def self.batch(batch: Batch.new)
  yield(batch)
  begin
    server = ChromeProcess.new
    batch.result(server.client)
  ensure
    if server.client.client.present?
      server.client.client.send_cmd 'Browser.close'
    end
    server.kill
    batch.cleanup
  end
end