module Salus::Configuration

Constants

VALID_OPTIONS_KEYS

An array of valid keys in the options hash when configuring Salus.

Public Class Methods

extended(base) click to toggle source

Sets all configuration options to their default values when this module is extended.

# File lib/salus/configuration.rb, line 11
def self.extended(base)
  base.reset
end

Public Instance Methods

configure() { |self| ... } click to toggle source

Convenience method to allow configuration options to be set in a block.

# File lib/salus/configuration.rb, line 16
def configure
  yield self
end
options() click to toggle source

Creates a hash of options and their values.

# File lib/salus/configuration.rb, line 21
def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end
reset() click to toggle source

Resets all configuration options to the defaults.

# File lib/salus/configuration.rb, line 28
def reset
  self.min_threads = CPU.count / 2
  self.min_threads = 1 if self.min_threads == 0
  self.max_threads = CPU.count * 2
  self.interval = 30
  self.tick_timeout   = 15
  self.render_timeout = 10
  self.logger   = Logger.new(STDERR)
end