Ruby 2.6 has added Enumerable#filter as an alias of Enumerable#select.
for adding Enumerable#filter as an alias is to make it easier for people
coming from other languages to use Ruby.
A lot of other languages including
Java, R, PHP etc. have filter method to filter/select records
Let’s take an example in which we have to select/filter all numbers which are divisible by 5
from a range.
Also note that along with Enumerable#filter, Enumerable#filter! is also added as an alias