Abinoam Jr. wrote in post #1136125:
> Dear Arup,
>
> I don't know if the code bellow could read better in your opinion.
>
> But, from your first example you could pass "a" as an object on the
> iteration.
>
> def del_first_three_refactored_2(a)
>   num_to_del = a.find { |e| a.count(e) >= 3 }
>   return a if num_to_del.nil?
>   3.times.with_object(a) do |turn, obj|
>     ind = obj.index { |e| e == num_to_del }
>     obj.delete_at(ind)
>   end
> end
>
> Does it fit?

This is good! Actually I forgot that `#times` give us `Enumerator` 
object.

Thank you very much. It reads nice to me.

-- 
Posted via http://www.ruby-forum.com/.