aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/engine/configurable.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/engine/configurable.rb')
-rw-r--r--railties/lib/rails/engine/configurable.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/lib/rails/engine/configurable.rb b/railties/lib/rails/engine/configurable.rb
new file mode 100644
index 0000000000..fb420e8a12
--- /dev/null
+++ b/railties/lib/rails/engine/configurable.rb
@@ -0,0 +1,24 @@
+module Rails
+ class Engine
+ module Configurable
+ def self.included(base)
+ base.extend ClassMethods
+ base.delegate :middleware, :root, :paths, :to => :config
+ end
+
+ module ClassMethods
+ def config
+ @config ||= Configuration.new(find_root_with_flag("lib"))
+ end
+
+ def inherited(base)
+ raise "You cannot inherit from a Rails::Engine child"
+ end
+ end
+
+ def config
+ self.class.config
+ end
+ end
+ end
+end \ No newline at end of file