Ruby method

Question I wrote this method but the array doesnt hold the values I would like the array length to increase each time the method is called

With a short piece of code like that it is better just to put it
inline. I don't understand exactly what problem you are seeing.
Please tell us exactly what code you call, what is the result and what
you expect the result to be. As I said, if the code is less than a
few dozen lines then paste it here to save us looking elsewhere.