diff --git a/lib/annotate_rb/model_annotator/zeitwerk_class_getter.rb b/lib/annotate_rb/model_annotator/zeitwerk_class_getter.rb index 86fb1a97..b7a36dce 100644 --- a/lib/annotate_rb/model_annotator/zeitwerk_class_getter.rb +++ b/lib/annotate_rb/model_annotator/zeitwerk_class_getter.rb @@ -49,7 +49,7 @@ def constant(loader) # once we have the filepath_relative_to_root_dir, we need to see if it # falls within one of our Zeitwerk "collapsed" paths. - if loader.collapse.any? { |path| path.include?(root_dir) && file.include?(path.split(root_dir)[1]) } + if loader.collapse.any? { |path| path.include?(root_dir) && @file.include?(path.split(root_dir)[1]) } # if the file is within a collapsed path, we then need to, for each # collapsed path, remove the root dir collapsed = loader.collapse.map { |path| path.split(root_dir)[1].sub(/^\//, "") }.to_set