From 99615907cb3e36a887d2c564207b2bae321790b4 Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 13 Jan 2009 16:02:00 +0000 Subject: Plugin.helper can be used to load helpers from other plugins using the 'plugin/helper' syntax. --- lib/coderay/helpers/plugin.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/coderay/helpers') 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 -- cgit v1.2.1