…====================
$ ruby data.rb
…/view.rb:1: undefined local variable or method a' for #<Object:0x40299c90> (NameError) from data.rb:3:inload’
from data.rb:3
…====================
I want to refer local variables ‘a’ and ‘b’ from view.rb.
Could you give me a good solution?
But I got the following error:
./view.rb:3: undefined local variable or method `a’
for #Object:0x40299c90 (NameError)
To create a function is not difficult,
but it is difficult to create a function automatically,
because it is needed to retrieve local variables automatically
when creating a function.
…--------------------
def print_view(a, b) # retrieve local vars
print “\n”
print " \n"
print " a = “; print((a)); print “, b=”; print((b)); print “\n”
print " \n”
print “\n”
end
…--------------------
Hmm…
I’ll use ERuby.import() meekly.
···
In message “[Q] pass local variables to loaded file” > on 03/02/18, kwatch kwatch@lycos.jp writes: