Refactor

USe each instead of for, as it is idiomatic in Ruby.