Sha256: f29d1f531f8006d0b88bb2fc7d97c1d62c4a7c8b06d95b060c21d325ba649cac

Contents?: true

Size: 250 Bytes

Versions: 15

Compression:

Stored size: 250 Bytes

Contents

# frozen_string_literal: true

class ReeArray::IndexBy
  include Ree::FnDSL

  fn :index_by

  contract(Or[ArrayOf[Any], Enumerable], Block => Hash)
  def call(list, &proc)
    result = {}
    list.each { result[yield(_1)] = _1 }
    result
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ree_lib-1.0.124 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_array/package/ree_array/functions/index_by.rb