lib/tapioca/constant_locator.rb in tapioca-0.5.4 vs lib/tapioca/constant_locator.rb in tapioca-0.5.5

- old
+ new

@@ -15,11 +15,17 @@ # Immediately activated upon load. Observes class/module definition. TracePoint.trace(:class) do |tp| unless tp.self.singleton_class? key = name_of(tp.self) + file = tp.path + if file == "(eval)" + file = T.must(caller_locations) + .drop_while { |loc| loc.path == "(eval)" } + .first&.path + end @class_files[key] ||= Set.new - @class_files[key] << tp.path + @class_files[key] << file end end # Returns the files in which this class or module was opened. Doesn't know # about situations where the class was opened prior to +require+ing,