From dfb0c922032ddaf9ddf5eb46a883f46715c0a50d Mon Sep 17 00:00:00 2001 From: murphy Date: Mon, 5 Jul 2010 07:26:35 +0000 Subject: Added all_plugins and all_titles methods to Plugin. --- lib/coderay/helpers/plugin.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/coderay/helpers') 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 -- cgit v1.2.1