class Array

Public Instance Methods

indices(value) click to toggle source

Accepts a value that is check against each element in the array itself and returns a new array containing the index for each matching element.

# File lib/aastdlib/array.rb, line 6
def indices(value)
        counter = 0
        indices = []

        self.each do |v|
                indices << counter if value == v
                counter+=1
        end

        return indices

end