Class: Elegant::Configuration

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

Overview

Provides an object to store global configuration settings.

This class is typically not used directly, but by calling Elegant.configure, which creates and updates a single instance of Configuration.

Examples:

Set the author of PDF files to ‘John Doe’:

Elegant.configure do |config|
  config.author = 'John Doe'
end

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



30
31
32
33
34
35
36
# File 'lib/elegant/configuration.rb', line 30

def initialize
  @author = 'Elegant'
  @creator = 'Elegant'
  @producer = 'Elegant'
  @watermark = asset 'images/default_watermark.png'
  @fonts = {'Sans Serif' => default_font, 'Fallback' => default_font}
end

Instance Attribute Details

#authorString

Returns the Author to store in the PDF metadata.

Returns:

  • (String)

    the Author to store in the PDF metadata



16
17
18
# File 'lib/elegant/configuration.rb', line 16

def author
  @author
end

#creatorString

Returns the Creator to store in the PDF metadata.

Returns:

  • (String)

    the Creator to store in the PDF metadata



19
20
21
# File 'lib/elegant/configuration.rb', line 19

def creator
  @creator
end

#fontsArray<Hash<Symbol, Hash<Symbol, String>] the fonts to use.

Returns Array<Hash<Symbol, Hash<Symbol, String>] the fonts to use.

Returns:

  • (Array<Hash<Symbol, Hash<Symbol, String>] the fonts to use.)

    Array<Hash<Symbol, Hash<Symbol, String>] the fonts to use.



28
29
30
# File 'lib/elegant/configuration.rb', line 28

def fonts
  @fonts
end

#producerString

Returns the Producer to store in the PDF metadata.

Returns:

  • (String)

    the Producer to store in the PDF metadata



22
23
24
# File 'lib/elegant/configuration.rb', line 22

def producer
  @producer
end

#watermarkString

Returns the path of an image to display on every page.

Returns:

  • (String)

    the path of an image to display on every page



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

def watermark
  @watermark
end