diff options
author | murphy <murphy@rubychan.de> | 2011-05-21 03:03:31 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2011-05-21 03:03:31 +0000 |
commit | 5efcf487985e7348ed3d39f33b7185028a6e3716 (patch) | |
tree | ddaa71a4884a5349d985526f88f11a7514c7b6d7 /lib/coderay/helpers/plugin.rb | |
parent | c5a193f08ddef1ba1cb5e1f9b0789b2f587022c4 (diff) | |
download | coderay-5efcf487985e7348ed3d39f33b7185028a6e3716.tar.gz |
various fixes and cleanups in CodeRay's helpers
Diffstat (limited to 'lib/coderay/helpers/plugin.rb')
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index f4f6739..e2b6616 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -120,14 +120,12 @@ module CodeRay end end - # Every plugin must register itself for one or more - # +ids+ by calling register_for, which calls this method. + # Every plugin must register itself for +id+ by calling register_for, + # which calls this method. # # See Plugin#register_for. - def register plugin, *ids - for id in ids - plugin_hash[validate_id(id)] = plugin - end + def register plugin, id + plugin_hash[validate_id(id)] = plugin end # A Hash of plugion_id => Plugin pairs. @@ -154,13 +152,6 @@ module CodeRay plugin_hash.values.grep(Class) end - # Returns an array of all plugin titles. - # - # Note: This loads all plugins using load_all. - def all_titles - all_plugins.map { |plugin| plugin.title } - end - protected # Return a plugin hash that automatically loads plugins. @@ -239,7 +230,8 @@ module CodeRay # See CodeRay::PluginHost for examples. module Plugin - # Register this class for the given langs. + # Register this class for the given +id+. + # # Example: # class MyPlugin < PluginHost::BaseClass # register_for :my_id @@ -247,9 +239,9 @@ module CodeRay # end # # See PluginHost.register. - def register_for *ids - @plugin_id = ids.first - plugin_host.register self, *ids + def register_for id + @plugin_id = id + plugin_host.register self, id end # Returns the title of the plugin, or sets it to the |