diff options
author | aycabta <aycabta@gmail.com> | 2021-09-10 06:08:56 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-09-10 06:37:07 +0900 |
commit | 90afe5f11f9c70ebab1ccb318712692884498931 (patch) | |
tree | f898e3a2371c0652015f0f4af0e4a92accd3e0ea | |
parent | 3503c94af501e38164613ef8347174a27346828a (diff) | |
download | ruby-90afe5f11f9c70ebab1ccb318712692884498931.tar.gz |
[ruby/irb] Move IRB::TOPLEVEL_BINDING from exe/irb to lib/irb/workspace.rb
https://github.com/ruby/irb/commit/e736a77076
-rw-r--r-- | lib/irb.rb | 2 | ||||
-rw-r--r-- | lib/irb/workspace.rb | 3 | ||||
-rwxr-xr-x | libexec/irb | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/irb.rb b/lib/irb.rb index c22e6db03b..665f67b946 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -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 diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index 8157e21644..2c4c40f348 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -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 diff --git a/libexec/irb b/libexec/irb index 7cd24482da..c64ee85fbd 100755 --- a/libexec/irb +++ b/libexec/irb @@ -8,5 +8,4 @@ require "irb" -IRB::TOPLEVEL_BINDING = binding IRB.start(__FILE__) |