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/railtie | |
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/railtie')
-rw-r--r-- | railties/lib/rails/railtie/configurable.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/railties/lib/rails/railtie/configurable.rb b/railties/lib/rails/railtie/configurable.rb new file mode 100644 index 0000000000..3850efa4a7 --- /dev/null +++ b/railties/lib/rails/railtie/configurable.rb @@ -0,0 +1,23 @@ +module Rails + class Railtie + module Configurable + def self.included(base) + base.extend ClassMethods + end + + module ClassMethods + def config + @config ||= Configuration.new + end + + def inherited(base) + raise "You cannot inherit from a Rails::Railtie child" + end + end + + def config + self.class.config + end + end + end +end |