Nice snippet! I made a slight change to accept single or array parameters: class Array def except(value) self - [value].flatten end end So now it works for single [1,2,3].exclude(2) And also works for multiple [1,2,3].exclude([1,3])
class Array def except(value) self - [value].flatten end end
[1,2,3].exclude(2)
[1,2,3].exclude([1,3])
Nice snippet! I made a slight change to accept single or array parameters:
class Array def except(value) self - [value].flatten end end
So now it works for single
[1,2,3].exclude(2)
And also works for multiple
[1,2,3].exclude([1,3])