Class: Array

Inherits:
Object show all
Defined in:
lib/ruco/core_ext/array.rb

Overview

Direct Known Subclasses

Ruco::Cursor

Instance Method Summary collapse

Instance Method Details

#map_with_index(&block) ⇒ Object



7
8
9
# File 'lib/ruco/core_ext/array.rb', line 7

def map_with_index(&block)
  dup.map_with_index!(&block)
end

#map_with_index!Object



3
4
5
# File 'lib/ruco/core_ext/array.rb', line 3

def map_with_index!
  each_with_index do |e, idx| self[idx] = yield(e, idx); end
end