I know global variables should never be used but right now it’s the only thing that I can get to work. So I’m looking for alternatives. What I want to do is pass @array which is is in method two in class New, to method one. The only way I was able to accomplish this is with $array.
module Test::Abc
class << self
def one
....
end
class New
def two
@array=[]
end
end
end
end
Here’s what I did to get the result I needed…
module Test::Abc
class << self
def one(array)
....
end
end
class New
def two
@array=[]
array=@array
Test::Abc::one(array)
end
end
end
Here’s what I came up with as a solution…