Module: Elegant::Config

Included in:
Elegant
Defined in:
lib/elegant/config.rb

Overview

Provides methods to read and write global configuration settings.

Examples:

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

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

Instance Method Summary collapse

Instance Method Details

#configurationElegant::Configuration

Returns the global Models::Configuration object.

While this method can be used to read and write configuration settings, it is easier to use #configure Elegant.configure}.

Examples:

Elegant.configuration.author = 'John Doe'

Returns:



33
34
35
# File 'lib/elegant/config.rb', line 33

def configuration
  @configuration ||= Elegant::Configuration.new
end

#configure {|Elegant::Configuration| ... } ⇒ Object

Yields the global configuration to the given block.

Examples:

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

Yields:



20
21
22
# File 'lib/elegant/config.rb', line 20

def configure
  yield configuration if block_given?
end