lib/rock_config/manager.rb in rock_config-0.0.1 vs lib/rock_config/manager.rb in rock_config-0.0.2
- old
+ new
@@ -5,10 +5,15 @@
@configs = initialize_configs
end
def fetch(config_name, environment)
if config = @configs[config_name]
- config.send environment
+ if config_for_environment = config.send(environment)
+ return config_for_environment
+ else
+ raise EnvironmentNotFoundError,
+ 'Environment "%s" not found' % environment
+ end
end
end
def initialize_configs
Hash.new do |hash, key|