mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Move IRB::TOPLEVEL_BINDING from exe/irb to lib/irb/workspace.rb
https://github.com/ruby/irb/commit/e736a77076
This commit is contained in:
parent
3503c94af5
commit
90afe5f11f
3 changed files with 4 additions and 2 deletions
|
@ -669,6 +669,8 @@ module IRB
|
|||
lines = lines.reverse if order == :bottom
|
||||
lines.map{ |l| l + "\n" }.join
|
||||
}
|
||||
# The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
|
||||
message = message.gsub(/\(irb\):(?<num>\d+):in `<(?<frame>top \(required\))>'/) { "(irb):#{$~[:num]}:in `<main>'" }
|
||||
puts message
|
||||
end
|
||||
print "Maybe IRB bug!\n" if irb_bug
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
require "delegate"
|
||||
|
||||
IRB::TOPLEVEL_BINDING = binding
|
||||
module IRB # :nodoc:
|
||||
class WorkSpace
|
||||
# Creates a new workspace.
|
||||
|
@ -57,7 +58,7 @@ EOF
|
|||
__FILE__,
|
||||
__LINE__ - 3)
|
||||
when 4 # binding is a copy of TOPLEVEL_BINDING (default)
|
||||
# Note that this will typically be IRB::TOPLEVEL_BINDING (see exe/irb)
|
||||
# Note that this will typically be IRB::TOPLEVEL_BINDING
|
||||
# This is to avoid RubyGems' local variables (see issue #17623)
|
||||
@binding = TOPLEVEL_BINDING.dup
|
||||
end
|
||||
|
|
|
@ -8,5 +8,4 @@
|
|||
|
||||
require "irb"
|
||||
|
||||
IRB::TOPLEVEL_BINDING = binding
|
||||
IRB.start(__FILE__)
|
||||
|
|
Loading…
Add table
Reference in a new issue