Sha256: fed9a0b7eeb3112814626ce95425badd0f128ffe1873af74d6f1cbc773dfb085

Contents?: true

Size: 273 Bytes

Versions: 2

Compression:

Stored size: 273 Bytes

Contents

module Enumerable
  def map_with_index(&block)
    result = []
    each_with_index { |element, ix| result << yield(element, ix) }
    result
  end

  def map_slice(num, &block)
    result = []
    each_slice(num) { |element| result << yield(element) }
    result
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space-0.0.3 lib/core_ext/enumerable.rb
space-0.0.2 lib/core_ext/enumerable.rb