aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/helpers.rb
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2011-04-25 15:02:41 +0200
committerPiotr Sarnacki <drogus@gmail.com>2011-04-25 15:02:41 +0200
commitd4bea35f1ae458246a9e3bb1c914c5d05b8e9cdf (patch)
tree8fb6c94cd42b25bd38421a6a2d23072bbcfa20f5 /actionpack/lib/action_controller/metal/helpers.rb
parent820c0feda33495cfe68add8c3f25adc515ab3e04 (diff)
downloadrails-d4bea35f1ae458246a9e3bb1c914c5d05b8e9cdf.tar.gz
rails-d4bea35f1ae458246a9e3bb1c914c5d05b8e9cdf.tar.bz2
rails-d4bea35f1ae458246a9e3bb1c914c5d05b8e9cdf.zip
Make ActionController::Base.modules_for_helpers and ActionController::Base.all_helpers_from_path public methods
Diffstat (limited to 'actionpack/lib/action_controller/metal/helpers.rb')
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb52
1 files changed, 26 insertions, 26 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb
index 91a88ab68a..75757db564 100644
--- a/actionpack/lib/action_controller/metal/helpers.rb
+++ b/actionpack/lib/action_controller/metal/helpers.rb
@@ -76,35 +76,35 @@ module ActionController
@helper_proxy ||= ActionView::Base.new.extend(_helpers)
end
- private
- # Overwrite modules_for_helpers to accept :all as argument, which loads
- # all helpers in helpers_path.
- #
- # ==== Parameters
- # * <tt>args</tt> - A list of helpers
- #
- # ==== Returns
- # * <tt>array</tt> - A normalized list of modules for the list of helpers provided.
- def modules_for_helpers(args)
- args += all_application_helpers if args.delete(:all)
- super(args)
- end
+ # Overwrite modules_for_helpers to accept :all as argument, which loads
+ # all helpers in helpers_path.
+ #
+ # ==== Parameters
+ # * <tt>args</tt> - A list of helpers
+ #
+ # ==== Returns
+ # * <tt>array</tt> - A normalized list of modules for the list of helpers provided.
+ def modules_for_helpers(args)
+ args += all_application_helpers if args.delete(:all)
+ super(args)
+ end
- # Extract helper names from files in <tt>app/helpers/**/*_helper.rb</tt>
- def all_application_helpers
- all_helpers_from_path(helpers_path)
+ def all_helpers_from_path(path)
+ helpers = []
+ Array.wrap(path).each do |_path|
+ extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
+ helpers += Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
end
+ helpers.sort!
+ helpers.uniq!
+ helpers
+ end
- def all_helpers_from_path(path)
- helpers = []
- Array.wrap(path).each do |_path|
- extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
- helpers += Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1') }
- end
- helpers.sort!
- helpers.uniq!
- helpers
- end
+ private
+ # Extract helper names from files in <tt>app/helpers/**/*_helper.rb</tt>
+ def all_application_helpers
+ all_helpers_from_path(helpers_path)
+ end
end
end
end