Class: Gotenberg::Chromium

Inherits:
Object
  • Object
show all
Includes:
Files, Headers, Metadata, Properties, Extractors
Defined in:
lib/gotenberg/chromium.rb,
lib/gotenberg/chromium/files.rb,
lib/gotenberg/chromium/headers.rb,
lib/gotenberg/chromium/metadata.rb,
lib/gotenberg/chromium/properties.rb

Defined Under Namespace

Modules: Files, Headers, Metadata, Properties

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Properties

#emulate_media_type, #extra_http_headers, #fail_on_console_exceptions, #landscape, #margins, #native_page_ranges, #paper_size, #pdf_format, #prefer_css_page_size, #print_background, #properties, #scale, #url, #user_agent, #wait_delay, #wait_for_expression

Methods included from Files

#assets, #binary_assets, #files, #footer, #header, #html, #markdown

Methods included from Headers

#headers, #trace, #webhook, #webhook_error_method, #webhook_extra_http_headers, #webhook_method

Methods included from Metadata

#meta, #metadata_available?

Constructor Details

#initialize(args) {|_self| ... } ⇒ Chromium

Returns a new instance of Chromium.

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
28
# File 'lib/gotenberg/chromium.rb', line 22

def initialize args
  args.each do |key, value|
    public_send(('%s=' % key), value)
  end

  yield self if block_given?
end

Instance Attribute Details

#base_pathObject

Returns the value of attribute base_path.



15
16
17
# File 'lib/gotenberg/chromium.rb', line 15

def base_path
  @base_path
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



16
17
18
# File 'lib/gotenberg/chromium.rb', line 16

def endpoint
  @endpoint
end

#exceptionObject (readonly)

Returns the value of attribute exception.



16
17
18
# File 'lib/gotenberg/chromium.rb', line 16

def exception
  @exception
end

#responseObject (readonly)

Returns the value of attribute response.



16
17
18
# File 'lib/gotenberg/chromium.rb', line 16

def response
  @response
end

Class Method Details

.call(base_path, &block) ⇒ Object



18
19
20
# File 'lib/gotenberg/chromium.rb', line 18

def self.call(base_path, &block)
  new(base_path: base_path, &block).call
end

Instance Method Details

#callObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/gotenberg/chromium.rb', line 30

def call
  backtrace if html_debug?
  transform

  if success? &&  
    
  end

  self
end

#html_debug?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/gotenberg/chromium.rb', line 49

def html_debug?
  Gotenberg.configuration.html_debug == true
end

#success?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/gotenberg/chromium.rb', line 41

def success?
  exception == nil
end

#to_binaryObject



45
46
47
# File 'lib/gotenberg/chromium.rb', line 45

def to_binary
  response || raise(exception)
end