diff lib/redmine/configuration.rb @ 245:051f544170fe

* Update to SVN trunk revision 4993
author Chris Cannam
date Thu, 03 Mar 2011 11:42:28 +0000
parents 0579821a129a
children cbb26bc654de
line wrap: on
line diff
--- a/lib/redmine/configuration.rb	Thu Mar 03 11:40:10 2011 +0000
+++ b/lib/redmine/configuration.rb	Thu Mar 03 11:42:28 2011 +0000
@@ -66,6 +66,16 @@
         @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)