Method: AbstractController::Helpers::ClassMethods#modules_for_helpers
- Defined in:
- lib/abstract_controller/helpers.rb
#modules_for_helpers(args) ⇒ Object
Returns a list of modules, normalized from the acceptable kinds of helpers with the following behavior:
- String or Symbol
-
:FooBar or “FooBar” becomes “foo_bar_helper”,
and "foo_bar_helper.rb" is loaded using require_dependency.
- Module
-
No further processing
After loading the appropriate files, the corresponding modules are returned.
Parameters
-
args- An array of helpers
Returns
-
Array- A normalized list of modules for the list of helpers provided.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/abstract_controller/helpers.rb', line 130 def modules_for_helpers(args) args.flatten.map! do |arg| case arg when String, Symbol file_name = "#{arg.to_s.underscore}_helper" require_dependency(file_name, "Missing helper file helpers/%s.rb") file_name.camelize.constantize when Module arg else raise ArgumentError, "helper must be a String, Symbol, or Module" end end end |