summaryrefslogtreecommitdiffstats
path: root/lib/redmine/configuration.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-25 14:30:05 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-02-25 14:30:05 +0000
commite1ad561cf652713bbdebe2d60fc4c680fb367ec1 (patch)
treec753c86d88606d80d698389ce20abf08c4ab7e7b /lib/redmine/configuration.rb
parent2b80f4636177243276c30e8aa4edf1b204d9de61 (diff)
downloadredmine-e1ad561cf652713bbdebe2d60fc4c680fb367ec1.tar.gz
redmine-e1ad561cf652713bbdebe2d60fc4c680fb367ec1.zip
Adds a method to temporarily override configuration settings.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4949 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/configuration.rb')
-rw-r--r--lib/redmine/configuration.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index 1d2443a9c..34880ce58 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -66,6 +66,16 @@ module Redmine
@config[name]
end
+ # Yields a block with the specified hash configuration settings
+ def with(settings)
+ settings.stringify_keys!
+ load unless @config
+ was = settings.keys.inject({}) {|h,v| h[v] = @config[v]; h}
+ @config.merge! settings
+ yield if block_given?
+ @config.merge! was
+ end
+
private
def load_from_yaml(filename, env)