class Postdoc::Client

Attributes

client[RW]

Public Class Methods

new(port) click to toggle source
# File lib/postdoc/client.rb, line 10
def initialize(port)
  @port = port
  100.times { setup_connection_or_wait && break }
  raise 'ChromeClient couldn\'t launch' if @client.blank?
end

Public Instance Methods

print_document(file_path, settings: PrintSettings.new) click to toggle source
print_pdf_from_html(file_path, settings: PrintSettings.new) click to toggle source

We should move away from passing options like this and collect them in the prinbt settings.

Private Instance Methods

setup_connection_or_wait() click to toggle source
# File lib/postdoc/client.rb, line 41
def setup_connection_or_wait
  @client = ChromeRemote.client(port: @port)
  true
rescue
  sleep(0.1)
  false
end