File tree Expand file tree Collapse file tree 4 files changed +4
-3
lines changed Expand file tree Collapse file tree 4 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 3
3
require "bundler/setup"
4
4
require_relative "../lib/irb"
5
5
6
- IRB ::TOPLEVEL_BINDING = binding
7
6
IRB . start ( __FILE__ )
Original file line number Diff line number Diff line change 8
8
9
9
require "irb"
10
10
11
- IRB ::TOPLEVEL_BINDING = binding
12
11
IRB . start ( __FILE__ )
Original file line number Diff line number Diff line change @@ -669,6 +669,8 @@ def handle_exception(exc)
669
669
lines = lines . reverse if order == :bottom
670
670
lines . map { |l | l + "\n " } . join
671
671
}
672
+ # The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
673
+ message = message . gsub ( /\( irb\) :(?<num>\d +):in `<(?<frame>top \( required\) )>'/ ) { "(irb):#{ $~[ :num ] } :in `<main>'" }
672
674
puts message
673
675
end
674
676
print "Maybe IRB bug!\n " if irb_bug
Original file line number Diff line number Diff line change 12
12
13
13
require "delegate"
14
14
15
+ IRB ::TOPLEVEL_BINDING = binding
15
16
module IRB # :nodoc:
16
17
class WorkSpace
17
18
# Creates a new workspace.
@@ -57,7 +58,7 @@ def initialize(*main)
57
58
__FILE__ ,
58
59
__LINE__ - 3 )
59
60
when 4 # binding is a copy of TOPLEVEL_BINDING (default)
60
- # Note that this will typically be IRB::TOPLEVEL_BINDING (see exe/irb)
61
+ # Note that this will typically be IRB::TOPLEVEL_BINDING
61
62
# This is to avoid RubyGems' local variables (see issue #17623)
62
63
@binding = TOPLEVEL_BINDING . dup
63
64
end
You can’t perform that action at this time.
0 commit comments