I have an array of elements in Ruby
[2,4,6,3,8]
I need to remove elements with value 3 for example
3
How do I do that?<
If you also want to make this deletion operation chainable, so you can delete some item and keep on chaining operations on the resulting array, use tap:
tap
[2, 4, 6, 3, 8].tap { |ary| ary.delete(3) }.count #=> 4