class Kinetic::Configuration

Configuration can be set either by passing the {Kinetic::DSL#set set} method and or by using the {Kinetic::DSL#config_file config_file} method.

@example

require 'kinetic'

config_file 'config.yml' # loads the values in config_file into configuration
set :host,  'localhost'  # sets config.host to 'localhost'

Accessing configuration values by their method accessors will raise {Kinetic::Errors::MissingConfigurationValue} error. This can be used to ensure that specific values are set at runtime. To access a value without raising an exception use the hash key instead.

@example

config.host   # raises an error if the config host value is not set
config[:host] # returns nil if the host value is not set

Constants

DEFAULTS

Default configuration values.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/kinetic/configuration.rb, line 36
def initialize
  super
  self.deep_merge!(DEFAULTS)
end

Private Instance Methods

method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/kinetic/configuration.rb, line 44
def method_missing(meth, *args, &block)
  value = super
  raise Kinetic::Errors::MissingConfigurationValue.new("Configuration is missing value for #{meth}") unless value
  value
end