aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/configuration.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/configuration.rb')
-rw-r--r--railties/lib/rails/configuration.rb25
1 files changed, 14 insertions, 11 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb
index bf5b9478cc..086f67a419 100644
--- a/railties/lib/rails/configuration.rb
+++ b/railties/lib/rails/configuration.rb
@@ -5,22 +5,26 @@ module Rails
# configuration class while this bit is being cleaned up.
class Plugin::Configuration
- def initialize
- @options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
+ def self.default
+ @default ||= new
end
- def middleware
- @middleware ||= ActionDispatch::MiddlewareStack.new
+ attr_reader :middleware
+
+ def initialize(base = nil)
+ if base
+ @options = base.options.dup
+ @middleware = base.middleware.dup
+ else
+ @options = Hash.new { |h,k| h[k] = ActiveSupport::OrderedOptions.new }
+ @middleware = ActionDispatch::MiddlewareStack.new
+ end
end
def respond_to?(name)
super || name.to_s =~ config_key_regexp
end
- def merge(config)
- @options = config.options.merge(@options)
- end
-
protected
attr_reader :options
@@ -41,8 +45,7 @@ module Rails
end
def config_keys
- ([ :active_support, :active_record, :action_controller,
- :action_view, :action_mailer, :active_resource ] +
+ ([ :active_support, :action_view, :action_mailer, :active_resource ] +
Plugin.plugin_names).map { |n| n.to_s }.uniq
end
end
@@ -60,7 +63,7 @@ module Rails
:log_level, :log_path, :paths, :routes_configuration_file,
:view_path
- def initialize
+ def initialize(base = nil)
super
@load_once_paths = []
@after_initialize_blocks = []