K
Krzysztof Loch
Hi, I know that dynamic variables created in block it is not accessible
from outside of that block but I noticed that dynamic constants can be
accessed and I want to know why it is so.
Sorry for my bad english. For better understanding of my problem I'm
attaching code below.
%w[magic MAGIC].each do |x|
eval <<-RUBY
#{x}_dynamic = 1
RUBY
end
And now you can try..
magic_dynamic
MAGIC_dynamic
You can observe it using 1.9 version of ruby.
from outside of that block but I noticed that dynamic constants can be
accessed and I want to know why it is so.
Sorry for my bad english. For better understanding of my problem I'm
attaching code below.
%w[magic MAGIC].each do |x|
eval <<-RUBY
#{x}_dynamic = 1
RUBY
end
And now you can try..
magic_dynamic
MAGIC_dynamic
You can observe it using 1.9 version of ruby.