@@ -9,7 +9,7 @@ module ApplicationLoadPaths
99 class << self
1010 extend T ::Sig
1111
12- sig { params ( root : String , environment : String ) . returns ( T ::Array [ String ] ) }
12+ sig { params ( root : String , environment : String ) . returns ( T ::Hash [ String , Module ] ) }
1313 def extract_relevant_paths ( root , environment )
1414 require_application ( root , environment )
1515 all_paths = extract_application_autoload_paths
@@ -18,30 +18,30 @@ def extract_relevant_paths(root, environment)
1818 relative_path_strings ( relevant_paths )
1919 end
2020
21- sig { returns ( T ::Array [ String ] ) }
21+ sig { returns ( T ::Hash [ String , Module ] ) }
2222 def extract_application_autoload_paths
2323 Rails . autoloaders . inject ( { } ) do |h , loader |
2424 h . merge ( loader . root_dirs )
25- end . keys
25+ end
2626 end
2727
2828 sig do
29- params ( all_paths : T ::Array [ String ] , bundle_path : Pathname , rails_root : Pathname )
30- . returns ( T ::Array [ Pathname ] )
29+ params ( all_paths : T ::Hash [ String , Module ] , bundle_path : Pathname , rails_root : Pathname )
30+ . returns ( T ::Hash [ Pathname , Module ] )
3131 end
3232 def filter_relevant_paths ( all_paths , bundle_path : Bundler . bundle_path , rails_root : Rails . root )
3333 bundle_path_match = bundle_path . join ( "**" )
3434 rails_root_match = rails_root . join ( "**" )
3535
3636 all_paths
37- . map { |path | Pathname . new ( path ) . expand_path }
37+ . transform_keys { |path | Pathname . new ( path ) . expand_path }
3838 . select { |path | path . fnmatch ( rails_root_match . to_s ) } # path needs to be in application directory
3939 . reject { |path | path . fnmatch ( bundle_path_match . to_s ) } # reject paths from vendored gems
4040 end
4141
42- sig { params ( load_paths : T ::Array [ Pathname ] , rails_root : Pathname ) . returns ( T ::Array [ String ] ) }
42+ sig { params ( load_paths : T ::Hash [ Pathname , Module ] , rails_root : Pathname ) . returns ( T ::Hash [ String , Module ] ) }
4343 def relative_path_strings ( load_paths , rails_root : Rails . root )
44- load_paths . map { |path | Pathname . new ( path ) . relative_path_from ( rails_root ) . to_s }
44+ load_paths . transform_keys { |path | Pathname . new ( path ) . relative_path_from ( rails_root ) . to_s }
4545 end
4646
4747 private
@@ -59,7 +59,7 @@ def require_application(root, environment)
5959 end
6060 end
6161
62- sig { params ( paths : T ::Array [ Pathname ] ) . void }
62+ sig { params ( paths : T ::Hash [ T . untyped , Module ] ) . void }
6363 def assert_load_paths_present ( paths )
6464 if paths . empty?
6565 raise <<~EOS
0 commit comments