mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use string lengths instead of regexp to extract path
The regexp was introduced in 186ac4cdaa
,
and looks cosmetic. While they should be functionally identical in
theory, in practice, case insensitive (but preserving) filesystems can
give results that are differently-cased from the pattern we supplied.
I don't know how to force the filesystem to do the surprising thing,
even when running in an environment that _could_, so no new test.
This commit is contained in:
parent
047a893da7
commit
eb68fec314
1 changed files with 1 additions and 2 deletions
|
@ -100,8 +100,7 @@ module ActionController
|
|||
# # => ["application", "chart", "rubygems"]
|
||||
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 = Dir["#{_path}/**/*_helper.rb"].map { |file| file[_path.to_s.size + 1..-"_helper.rb".size - 1] }
|
||||
names.sort!
|
||||
end
|
||||
helpers.uniq!
|
||||
|
|
Loading…
Reference in a new issue