instance method
all_helpers_from_path
Ruby on Rails 5.2.8.1
Since v3.1.12 Last seen in v7.0.10Signature
all_helpers_from_path(path)
Returns a list of helper names in a given path.
ActionController::Base.all_helpers_from_path 'app/helpers' # => ["application", "chart", "rubygems"]
Parameters
-
pathreq
Source
# File actionpack/lib/action_controller/metal/helpers.rb, line 101
def all_helpers_from_path(path)
helpers = Array(path).flat_map do |_path|
extract = /^#{Regexp.quote(_path.to_s)}\/?(.*)_helper.rb$/
names = Dir["#{_path}/**/*_helper.rb"].map { |file| file.sub(extract, '\1'.freeze) }
names.sort!
end
helpers.uniq!
helpers
end
Defined in actionpack/lib/action_controller/metal/helpers.rb line 101
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::Helpers::ClassMethods