Module: Enumerable

Defined in:
lib/rprb.rb

Overview

This code is release by the authors into the Public Domain

Instance Method Summary collapse

Instance Method Details

#collect_with_indexObject



4
5
6
7
8
9
10
# File 'lib/rprb.rb', line 4

def collect_with_index
    result = []
    each_with_index { |elem, i|
        result << yield(elem, i)
    }
    result
end