Sha256: 5800f17c9a2ba8e2925b307154443636d7fdf052e75149f14a62380f66f7bf73
Contents?: true
Size: 414 Bytes
Versions: 10
Compression:
Stored size: 414 Bytes
Contents
require 'facets/functor' module Enumerable # Accumulate a set of a set. # # For example, in an ORM design if Group # has_many User then # # groups.accumulate.users # # will return a list of users from all groups. # # CREDIT: George Moshchovitis def accumulate @_accumulate ||= Functor.new do |op, *args| inject([]) { |a, x| a << x.send(op, *args) }.flatten end end end
Version data entries
10 entries across 10 versions & 1 rubygems