Array#delete, but return the array?
If you want to mutate the original array, like delete
, here are options:
ary.reject!{|e| e==42 }.something_else
ary.tap{|a| a.delete 42}.something_else
(ary.delete 42;ary).something_else
(ary-=[42]).something_else
If you want a new array to chain from:
ary.reject{|e| e==42 }.something_else
(ary-[42]).something_else
array.reject{|element| element == value_of_element_to_be_deleted}
an_ary.-([el])
looks awful.
What about...
an_ary - [el]
?
The most natural way of dealing with mathematical operations is this...
4 - 2
Not this...
4.-(2)