Sha256: 545d5be7b481a316d1e226aa63e97816efe823929b32123048994bebe6f2bd35

Contents?: true

Size: 246 Bytes

Versions: 2

Compression:

Stored size: 246 Bytes

Contents

# Add pluck to enumerable... its already done for us in rails 5+
module Enumerable
  def pluck(*keys)
    map { |element| keys.map { |key| element[key] } }
      .flatten(keys.count > 1 ? 0 : 1)
  end
end unless Enumerable.method_defined? :pluck

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hyper-model-1.0.alpha1.8 lib/enumerable/pluck.rb
hyper-model-1.0.alpha1.7 lib/enumerable/pluck.rb