diff options
author | Carl Lerche <carllerche@mac.com> | 2009-12-15 22:07:12 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2009-12-15 22:13:52 -0800 |
commit | 1b27f5c4f72384081083fa025b6b10e5ab02ae5e (patch) | |
tree | 43bbf10ed39c70f7937709de8b0805002f93eca5 /railties/lib/rails/plugin.rb | |
parent | f0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e (diff) | |
download | rails-1b27f5c4f72384081083fa025b6b10e5ab02ae5e.tar.gz rails-1b27f5c4f72384081083fa025b6b10e5ab02ae5e.tar.bz2 rails-1b27f5c4f72384081083fa025b6b10e5ab02ae5e.zip |
Add the ability for plugins to set default configuration settings.
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r-- | railties/lib/rails/plugin.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb index 8025135a64..90dc1ad8dd 100644 --- a/railties/lib/rails/plugin.rb +++ b/railties/lib/rails/plugin.rb @@ -2,6 +2,27 @@ module Rails class Plugin include Initializable + def self.plugin_name + @plugin_name || name.demodulize.underscore + end + + def self.inherited(klass) + @plugins ||= [] + @plugins << klass unless klass == Vendored + end + + def self.plugins + @plugins + end + + def self.plugin_names + plugins.map { |p| p.plugin_name } + end + + def self.config + @config ||= Configuration.new + end + class Vendored < Plugin def self.all(list, paths) plugins = [] |