diff options
-rw-r--r-- | Changes.textile | 2 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Changes.textile b/Changes.textile index a2bd534..09c7919 100644 --- a/Changes.textile +++ b/Changes.textile @@ -257,6 +257,8 @@ h3. @Plugin@ * *IMPROVED*: @register_for@ sets the @plugin_id@; it can now be a @Symbol@. * *ADDED* @PluginHost#const_missing@ method: Plugins are loaded automatically. Using @Scanners::JavaScript@ in your code loads @scanners/java_script.rb@. +* *ADDED* @#all_plugins@ and @#all_titles@ methods to simplify getting + information about all available plugins (suggested by bnhymn). h3. Internal API changes diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index ada5ae7..96bfdd6 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -188,6 +188,21 @@ module CodeRay end end + # Returns an array of all Plugins. + # + # Note: This loads all plugins using load_all. + def all_plugins + load_all + 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 + # Makes a map of all loaded plugins. def inspect map = plugin_hash.dup |