Referring to the below code is there a way that I can pass the variable row from class A to class B#kick and get the data stored?
class A attr_accessor :row def fetch B.new.kick(self.row) puts row.inspect end end class B def kick(x) x = [3,4] end end @test = A.new.fetch expect(@test.row).to eql([3,4]) Current O/P => nil
However If I pass self and assign that works , but I dont want to use this approach: Working Code
class A attr_accessor :row def fetch B.new.kick(self) puts row.inspect end end class B def kick(x) x.row = [3,4] end end @test = A.new.fetch #=> [3, 4]