summaryrefslogtreecommitdiff
path: root/lib/coderay/helpers/plugin.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2009-01-13 16:02:00 +0000
committermurphy <murphy@rubychan.de>2009-01-13 16:02:00 +0000
commit99615907cb3e36a887d2c564207b2bae321790b4 (patch)
treec8dba05f7feb1d3a7b0038d7940f8bc854100291 /lib/coderay/helpers/plugin.rb
parentdee392f22511b9e91dfa3dc089be30a940e027c9 (diff)
downloadcoderay-99615907cb3e36a887d2c564207b2bae321790b4.tar.gz
Plugin.helper can be used to load helpers from other plugins using the 'plugin/helper' syntax.
Diffstat (limited to 'lib/coderay/helpers/plugin.rb')
-rw-r--r--lib/coderay/helpers/plugin.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb
index 4ae8e7a..6f074c3 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin.rb
@@ -303,9 +303,17 @@ module Plugin
#
# The above example loads the file myplugin/my_helper.rb relative to the
# file in which MyPlugin was defined.
+ #
+ # You can also load a helper from a different plugin:
+ #
+ # helper 'other_plugin/other_helper'
def helper *helpers
for helper in helpers
- self::PLUGIN_HOST.require_helper plugin_id, helper.to_s
+ if helper.is_a?(String) && helper[/\//]
+ self::PLUGIN_HOST.require_helper $`, $'
+ else
+ self::PLUGIN_HOST.require_helper plugin_id, helper.to_s
+ end
end
end