K
Kósa Márton
Hi group,
I apologize for the newbie question.
Is there in Ruby some possibility for making global
variables visible from within a DEF, except that
passing all of them as parameters?
E.g.:
class class1
....
def some_method
...
end
end
....
g = class1.new
....
def f(g) <--- i'd like to avoid to pass g here
....
g.some_method
....
end
I have not found any other solution in the documentation.
When the number of these global objects become large (e.g. >20),
passing all of them each time becomes incomfortable.
Any help appreciated.
Marton
I apologize for the newbie question.
Is there in Ruby some possibility for making global
variables visible from within a DEF, except that
passing all of them as parameters?
E.g.:
class class1
....
def some_method
...
end
end
....
g = class1.new
....
def f(g) <--- i'd like to avoid to pass g here
....
g.some_method
....
end
I have not found any other solution in the documentation.
When the number of these global objects become large (e.g. >20),
passing all of them each time becomes incomfortable.
Any help appreciated.
Marton