Method: Enumerable#select_with_index!
- Defined in:
- lib/quality_extensions/enumerable/select_with_index.rb
#select_with_index! ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/quality_extensions/enumerable/select_with_index.rb', line 32 def select_with_index! index = -1 if block_given? select! { |x| index += 1; yield(x, index) } else self end end |