Project

General

Profile

Actions

Bug #16764

closed

Module.const_source_location does not work on autoloaded constants

Added by exterm (Philip Müller) over 4 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
[ruby-core:97733]

Description

As we found when trying out const_source_location on a Rails project, it breaks when used on autoloaded constants.

Example:

$ cat foo.rb
autoload :Bar, './bar'

Bar

puts Module.const_source_location("Bar")

Returns foo.rb:3, when it should return bar.rb:1.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0