[ruby/irb] Change context-mode's default to new mode 4.
This new mode uses a copy of the TOPLEVEL_BINDING. This is compatible with refinements (contrary to mode 3), while keeping nested IRB sessions separate https://github.com/ruby/irb/commit/25c731cb2f
This commit is contained in:
parent
753222d72c
commit
980f994b3b
@ -108,7 +108,7 @@ module IRB # :nodoc:
|
||||
@CONF[:PROMPT_MODE] = (STDIN.tty? ? :DEFAULT : :NULL)
|
||||
@CONF[:AUTO_INDENT] = true
|
||||
|
||||
@CONF[:CONTEXT_MODE] = 3 # use binding in function on TOPLEVEL_BINDING
|
||||
@CONF[:CONTEXT_MODE] = 4 # use a copy of TOPLEVEL_BINDING
|
||||
@CONF[:SINGLE_IRB] = false
|
||||
|
||||
@CONF[:LC_MESSAGES] = Locale.new
|
||||
|
@ -51,11 +51,13 @@ EOF
|
||||
end
|
||||
@binding = BINDING_QUEUE.pop
|
||||
|
||||
when 3 # binding in function on TOPLEVEL_BINDING(default)
|
||||
when 3 # binding in function on TOPLEVEL_BINDING
|
||||
@binding = eval("self.class.remove_method(:irb_binding) if defined?(irb_binding); private; def irb_binding; binding; end; irb_binding",
|
||||
TOPLEVEL_BINDING,
|
||||
__FILE__,
|
||||
__LINE__ - 3)
|
||||
when 4 # binding is a copy of TOPLEVEL_BINDING (default)
|
||||
@binding = TOPLEVEL_BINDING.dup
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user