module Siberite::Config

Attributes

config[RW]
environment[RW]

Public Instance Methods

default() click to toggle source
# File lib/siberite/config.rb, line 27
def default
  client_args_from config[environment.to_s]
end
load(config_file) click to toggle source
# File lib/siberite/config.rb, line 11
def load(config_file)
  self.config = YAML.load_file(config_file)
end
method_missing(namespace)
Alias for: namespace
namespace(namespace) click to toggle source
# File lib/siberite/config.rb, line 23
def namespace(namespace)
  client_args_from config[namespace.to_s][environment.to_s]
end
Also aliased as: method_missing
new_client(space = nil) click to toggle source
# File lib/siberite/config.rb, line 31
def new_client(space = nil)
  Client.new *(space ? namespace(space) : default)
end

Private Instance Methods

client_args_from(config) click to toggle source
# File lib/siberite/config.rb, line 39
def client_args_from(config)
  sanitized = config.inject({}) do |sanitized, (key, val)|
    sanitized[key.to_sym] = val; sanitized
  end
  servers = sanitized.delete(:servers)

  [servers, sanitized]
end