From 1651c8a0c9a7172d433da297b6f4418ad4a9ef25 Mon Sep 17 00:00:00 2001 From: Nate Matykiewicz Date: Fri, 7 Jun 2024 23:54:38 -0500 Subject: [PATCH] Move line back --- .../lib/ruby_indexer/configuration.rb | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb index 9eff9327f..5124789c4 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/configuration.rb @@ -66,19 +66,18 @@ def indexables indexables = patterns.flat_map do |pattern| load_path_entry = T.let(nil, T.nilable(String)) - Dir.glob(pattern, File::FNM_PATHNAME | File::FNM_EXTGLOB) - .map! do |path| - path = File.expand_path(path) - # All entries for the same pattern match the same $LOAD_PATH entry. Since searching the $LOAD_PATH for every - # entry is expensive, we memoize it until we find a path that doesn't belong to that $LOAD_PATH. This - # happens on repositories that define multiple gems, like Rails. All frameworks are defined inside the - # Dir.pwd, but each one of them belongs to a different $LOAD_PATH entry - if load_path_entry.nil? || !path.start_with?(load_path_entry) - load_path_entry = $LOAD_PATH.find { |load_path| path.start_with?(load_path) } - end - - IndexablePath.new(load_path_entry, path) + Dir.glob(pattern, File::FNM_PATHNAME | File::FNM_EXTGLOB).map! do |path| + path = File.expand_path(path) + # All entries for the same pattern match the same $LOAD_PATH entry. Since searching the $LOAD_PATH for every + # entry is expensive, we memoize it until we find a path that doesn't belong to that $LOAD_PATH. This happens + # on repositories that define multiple gems, like Rails. All frameworks are defined inside the Dir.pwd, but + # each one of them belongs to a different $LOAD_PATH entry + if load_path_entry.nil? || !path.start_with?(load_path_entry) + load_path_entry = $LOAD_PATH.find { |load_path| path.start_with?(load_path) } end + + IndexablePath.new(load_path_entry, path) + end end # Remove user specified patterns