Module | Innate::HelpersHelper |
In: |
lib/innate/helper.rb
|
Here come the utility methods used from the HelperAccess#helper method, we do this to keep method count at a minimum and because HelpersHelper is such an awesome name that just can‘t be wasted.
Usage if you want to only extend with helpers:
class Hi Innate::HelpersHelper.each_extend(self, :cgi, :link, :aspect) end
Usage if you only want to include helpers:
class Hi Innate::HelpersHelper.each_include(self, :cgi, :link, :aspect) end
Usage for iteration:
Innate::HelpersHelper.each(:cgi, :link, :aspect) do |mod| p mod end
Usage for translating helpers to modules:
p Innate::HelpersHelper.each(:cgi, :link, :aspect)
EXTS | = | %w[rb so bundle] |
Yield all the modules we can find for the given names of helpers, try to require them if not available.
NOTE: Unlike usual each, this will actually return an Array of the found
modules instead of the given +*names+
Usage:
Innate::HelpersHelper.each(:cgi, :link, :aspect) do |mod| p mod end
Shortcut to extend into with Helper modules corresponding to +*names+. into has to respond to extend.
Usage:
class Hi Innate::HelpersHelper.each_extend(self, :cgi, :link, :aspect) end
Shortcut to include Helper modules corresponding to +*names+ on into. into has to respond to include. #send(:include) is used in case include raises due to being private/protected
in case include is a private/protected method.
Usage:
class Hi Innate::HelpersHelper.each_include(self, :cgi, :link, :aspect) end
Based on a simple set of rules we will first construct the most likely name for the helper and then grep the constants in the Innate::Helper module for any matches.
helper :foo_bar # => FooBar helper :foo # => Foo