diff options
| author | Stan Lo <stan001212@gmail.com> | 2024-01-01 17:40:35 +0000 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-01-01 17:40:38 +0000 |
| commit | 676748abcad62c021fc122d137f177d3c0f0f7a8 (patch) | |
| tree | 4469367d361b5204b1e17e66b8ded3241b6ce03b /lib | |
| parent | 6934a60ab1d68ff89e0088a951a4c205f3c60332 (diff) | |
[ruby/irb] Make show_source resolve top-level constant names
(https://github.com/ruby/irb/pull/831)
https://github.com/ruby/irb/commit/5843616c78
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/irb/source_finder.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/source_finder.rb b/lib/irb/source_finder.rb index 659d4200fd..4e9cdc462a 100644 --- a/lib/irb/source_finder.rb +++ b/lib/irb/source_finder.rb @@ -19,7 +19,7 @@ module IRB def find_source(signature, super_level = 0) context_binding = @irb_context.workspace.binding case signature - when /\A[A-Z]\w*(::[A-Z]\w*)*\z/ # Const::Name + when /\A(::)?[A-Z]\w*(::[A-Z]\w*)*\z/ # Const::Name eval(signature, context_binding) # trigger autoload base = context_binding.receiver.yield_self { |r| r.is_a?(Module) ? r : Object } file, line = base.const_source_location(signature) |
