Class: PDFKit::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfkit/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pdfkit/configuration.rb', line 6

def initialize
  @verbose         = false
  @meta_tag_prefix = 'pdfkit-'
  @default_options = {
    :disable_smart_shrinking => false,
    :quiet => true,
    :page_size => 'Letter',
    :margin_top => '0.75in',
    :margin_right => '0.75in',
    :margin_bottom => '0.75in',
    :margin_left => '0.75in',
    :encoding => 'UTF-8'
  }
end

Instance Attribute Details

#default_optionsObject

Returns the value of attribute default_options.



3
4
5
# File 'lib/pdfkit/configuration.rb', line 3

def default_options
  @default_options
end

#meta_tag_prefixObject

Returns the value of attribute meta_tag_prefix.



3
4
5
# File 'lib/pdfkit/configuration.rb', line 3

def meta_tag_prefix
  @meta_tag_prefix
end

#root_urlObject

Returns the value of attribute root_url.



3
4
5
# File 'lib/pdfkit/configuration.rb', line 3

def root_url
  @root_url
end

#verbose=(value) ⇒ Object (writeonly)

Sets the attribute verbose

Parameters:

  • value

    the value to set the attribute verbose to.



4
5
6
# File 'lib/pdfkit/configuration.rb', line 4

def verbose=(value)
  @verbose = value
end

#wkhtmltopdfObject



21
22
23
# File 'lib/pdfkit/configuration.rb', line 21

def wkhtmltopdf
  @wkhtmltopdf ||= (defined?(Bundler::GemfileError) ? `bundle exec which wkhtmltopdf` : `which wkhtmltopdf`).chomp
end

Instance Method Details

#quiet?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/pdfkit/configuration.rb', line 25

def quiet?
  !@verbose
end

#verbose?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/pdfkit/configuration.rb', line 29

def verbose?
  @verbose
end