Sha256: ec37538de2f75d2d1a2433fdab4a5893ad22f01e886b675e03e17e0ba4963b41
Contents?: true
Size: 378 Bytes
Versions: 7
Compression:
Stored size: 378 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. def accumulate @_accumulate ||= Functor.new do |op, *args| inject([]) { |a, x| a << x.send(op, *args) }.flatten end end end
Version data entries
7 entries across 7 versions & 2 rubygems