summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-14 12:49:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-04-14 12:49:30 +0000
commitd6dc676d07427e4c1459e9c7509329bb54cbdc7c (patch)
tree02b1ff7ce92874923cd7bf07097483b78e2e701b /lib
parent698407450b6a43e7295f19691fd0cf42d553b211 (diff)
irb/{context,workspace}.rb: use local_variable_set
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/context.rb2
-rw-r--r--lib/irb/workspace.rb10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb
index 07a65c87d1..1a06ebfad1 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -262,7 +262,7 @@ module IRB
# to #last_value.
def set_last_value(value)
@last_value = value
- @workspace.evaluate self, "_ = IRB.CurrentContext.last_value"
+ @workspace.local_variable_set :_, value
end
# Sets the +mode+ of the prompt in this context.
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 5216520f32..53914fb7c1 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -71,7 +71,7 @@ EOF
end
end
end
- eval("_=nil", @binding)
+ @binding.local_variable_set(:_, nil)
end
# The Binding of this workspace
@@ -85,6 +85,14 @@ EOF
eval(statements, @binding, file, line)
end
+ def local_variable_set(name, value)
+ @binding.local_variable_set(name, value)
+ end
+
+ def local_variable_get(name)
+ @binding.local_variable_get(name)
+ end
+
# error message manipulator
def filter_backtrace(bt)
case IRB.conf[:CONTEXT_MODE]