I asked my question and got two answers one is piece of code and the other one is to use a library/module.
I am wondering what is better to use. Does it actually matter? Is there any difference in speed, code update or in any other way?
in my case the code is only a loop with 2 lines... My questions is more in general from somebody who is learning ruby and to write nice code