Remove redundant check in formula_files and cask_files
Formula_files consists of every non-recursive child of formula_dir, for which formula_file? evaluates to true. formula_file? checks if the file is a child of formula_dir, which it is by definition. It turns out that by removing the check, the time used for 'brew search' decreased from 800 ms to 700 ms, noticably faster during tab completion. The same happens with cask_files and cask_file?
This commit is contained in:
parent
cf1c951e2f
commit
6ac30826d0
@ -382,7 +382,7 @@ class Tap
|
||||
# an array of all {Formula} files of this {Tap}.
|
||||
def formula_files
|
||||
@formula_files ||= if formula_dir.directory?
|
||||
formula_dir.children.select(&method(:formula_file?))
|
||||
formula_dir.children.select { |file| file.extname == ".rb" }
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -391,7 +391,7 @@ class Tap
|
||||
# an array of all {Cask} files of this {Tap}.
|
||||
def cask_files
|
||||
@cask_files ||= if cask_dir.directory?
|
||||
cask_dir.children.select(&method(:cask_file?))
|
||||
cask_dir.children.select { |file| file.extname == ".rb" }
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user