diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-23 18:41:53 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-23 18:41:53 +0100 |
commit | 788fce2550ed587d86d239d8fcd488f919d15b5d (patch) | |
tree | 779386fb3bb2341af6a03e390233420b184cb891 /railties/lib/rails/engine/configurable.rb | |
parent | 2b75b94ac0c329de12a0a94ba77f8aad5574514f (diff) | |
download | rails-788fce2550ed587d86d239d8fcd488f919d15b5d.tar.gz rails-788fce2550ed587d86d239d8fcd488f919d15b5d.tar.bz2 rails-788fce2550ed587d86d239d8fcd488f919d15b5d.zip |
Create configurable modules and ensure that they are added only on direct children.
Diffstat (limited to 'railties/lib/rails/engine/configurable.rb')
-rw-r--r-- | railties/lib/rails/engine/configurable.rb | 24 |
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 |