Given an array arr and an object v, I want a copy of arr without the elements equal to v.
I found these two solutions:
newarr = arr.dup
newarr.delete(v)
and
newarr = arr.reject {|a| a == v}
Is there an easier way to do it?
I wonder whether Ruby already has something like:
newarr = arr.without(v)
If this is too cumbersome for you too, use: