class Elegant::Configuration
Provides an object to store global configuration settings.
This class is typically not used directly, but by calling {Elegant::Config#configure Elegant.configure}, which creates and updates a single instance of {Elegant::Configuration}.
@example Set the author of PDF files to 'John Doe':
Elegant.configure do |config| config.author = 'John Doe' end
@see Elegant::Config
for more examples.
Attributes
creator[RW]
@return [String] the Creator to store in the PDF metadata
fonts[RW]
@return [Array<Hash<Symbol, Hash<Symbol, String>] the fonts to use.
producer[RW]
@return [String] the Producer to store in the PDF metadata
watermark[RW]
@return [String] the path of an image to display on every page
Public Class Methods
new()
click to toggle source
# 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
Private Instance Methods
asset(file)
click to toggle source
# File lib/elegant/configuration.rb, line 45 def asset(file) File.expand_path "../#{file}", __FILE__ end
default_font()
click to toggle source
# File lib/elegant/configuration.rb, line 40 def default_font type = 'DejaVuSans' {normal: asset("fonts/#{type}.ttf"), bold: asset("fonts/#{type}Bold.ttf")} end