Sha256: dd065f8d961e4158d019ded937b2eb8f5a5a6b8f498bc8153abc4adc9aa99628

Contents?: true

Size: 290 Bytes

Versions: 32

Compression:

Stored size: 290 Bytes

Contents

module Enumerable
  # File activesupport/lib/active_support/core_ext/enumerable.rb, line 94
  def index_by
    return to_enum :index_by unless block_given?
    Hash[map { |elem| [yield(elem), elem] }]
  end

  def uniq_by
    h = {}
    inject([]) {|a,x| h[yield(x)] ||= a << x}
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
mspire-0.10.8.0 lib/core_ext/enumerable.rb
mspire-0.10.7.3 lib/core_ext/enumerable.rb
mspire-0.10.7.2 lib/core_ext/enumerable.rb
mspire-0.10.7.1 lib/core_ext/enumerable.rb
mspire-0.10.7 lib/core_ext/enumerable.rb
mspire-0.10.6 lib/core_ext/enumerable.rb
mspire-0.10.5 lib/core_ext/enumerable.rb
mspire-0.10.4 lib/core_ext/enumerable.rb
mspire-0.10.3 lib/core_ext/enumerable.rb
mspire-0.10.2 lib/core_ext/enumerable.rb
mspire-0.10.1 lib/core_ext/enumerable.rb
mspire-0.10.0 lib/core_ext/enumerable.rb
mspire-0.9.2 lib/core_ext/enumerable.rb
mspire-0.9.1 lib/core_ext/enumerable.rb
mspire-0.9.0 lib/core_ext/enumerable.rb
mspire-0.8.7 lib/core_ext/enumerable.rb
rubabel-0.4.3 lib/rubabel/core_ext/enumerable.rb
rubabel-0.4.2 lib/rubabel/core_ext/enumerable.rb
rubabel-0.4.1 lib/rubabel/core_ext/enumerable.rb
rubabel-0.4.0 lib/rubabel/core_ext/enumerable.rb