Sha256: b007e8912f2b1c3b7418e5155f4ad9820afe9351626fb738a66c6b46d5eaa23c
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
module Elegant # 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. class Configuration # @return [String] the Author to store in the PDF metadata attr_accessor :author # @return [String] the Creator to store in the PDF metadata attr_accessor :creator # @return [String] the Producer to store in the PDF metadata attr_accessor :producer # @return [String] the path of an image to display on every page attr_accessor :watermark # @return [Array<Hash<Symbol, Hash<Symbol, String>] the fonts to use. attr_accessor :fonts def initialize @author = 'Elegant' @creator = 'Elegant' @producer = 'Elegant' @watermark = asset 'images/default_watermark.png' @fonts = {'Sans Serif' => default_font, 'Fallback' => default_font} end private def default_font type = 'DejaVuSans' {normal: asset("fonts/#{type}.ttf"), bold: asset("fonts/#{type}Bold.ttf")} end def asset(file) File.expand_path "../#{file}", __FILE__ end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
elegant-1.2.1 | lib/elegant/configuration.rb |
elegant-1.2.0 | lib/elegant/configuration.rb |
elegant-1.1.0 | lib/elegant/configuration.rb |
elegant-1.0.0 | lib/elegant/configuration.rb |