Simply replace things
and thing
with whatever large object you're iterating
over and put your iteration code in place of the code comment.
In ruby you can append with_index
and an index variable to your enumerators
and it will give you an iterator counter (i
). Using this we calculate a progress precentage:
(i.to_f / things.length * 100).to_i