1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Improve wording of Local Variables and eval section

As pointed out by nobu, "defined" should be used instead of "assigned".
This commit is contained in:
Jeremy Evans 2019-06-25 11:18:08 -07:00
parent 0aa8c3d88b
commit 0f28094201

View file

@ -111,14 +111,14 @@ method.
== Local Variables and eval == Local Variables and eval
Using +eval+ to evaluate Ruby code will allow access to local variables in Using +eval+ to evaluate Ruby code will allow access to local variables defined
the same scope, even if the local variables are not assigned until after the in the same scope, even if the local variables are not defined until after the
call to +eval+. However, local variables assigned inside the call to +eval+ call to +eval+. However, local variables defined inside the call to +eval+
will not be reflected in the surrounding scope. Inside the call to +eval+, will not be reflected in the surrounding scope. Inside the call to +eval+,
local variables in the scope and local variables assigned inside the call to local variables defined in the surrounding scope and local variables defined
+eval+ will be accessible. However, you will not be able to access local inside the call to +eval+ will be accessible. However, you will not be able
variables assigned in previous or subsequent calls to +eval+ in the same to access local variables defined in previous or subsequent calls to +eval+ in
scope. Consider each +eval+ call a separate nested scope. Example: the same scope. Consider each +eval+ call a separate nested scope. Example:
def m def m
eval "bar = 1" eval "bar = 1"