|
|
|
|
|
by dragonwriter
4255 days ago
|
|
except .find_all.with_index passes the index to the predicate block, but still only returns a view of the matching elements from the list. What I think is being sought is more like: module Enumerable
def find_indices
each.with_index
.find_all {|x,_| yield x}
.map {|_,y| y}
end
end
|
|