Module: Squid::Config

Included in:
Squid
Defined in:
lib/squid/config.rb

Overview

Provides methods to read and write global configuration settings.

A typical usage is to set the default dimensions and colors for charts.

Note that Squid.configure has precedence over values through with environment variables (see Configuration).

Examples:

Set the default height for Squid graphs:

Squid.configure do |config|
  config.height = 150
end

Instance Method Summary collapse

Instance Method Details

#configurationSquid::Configuration

Returns the global Squid::Configuration object.

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

Examples:

Squid.configuration.height = 150

Returns:


38
39
40
# File 'lib/squid/config.rb', line 38

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

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

Yields the global configuration to the given block.

Examples:

Squid.configure do |config|
  config.height = 150
end

Yields:


25
26
27
# File 'lib/squid/config.rb', line 25

def configure
  yield configuration if block_given?
end