On Wednesday 31 May 2006 7:23 am, Kroeger, Simon (ext) wrote:

> > [...]
> > Something like this, probably:
> >
> > class User
> >   def files
> >     groups.inject([]) {|all_files, some_files|  all_files |
> > some_files}
> >   end
> > end
>
> Should be equivalent to:
>
> groups.flatten.uniq
>
> But does probably not work because (as you explained)
>
> "...And each of the elements in that array, if you
> call files() on it, returns another array"
>
> class User
>   def files
>     groups.inject([]) {|all_files, group|  all_files | group.files}
>   end
> end

Doh!  Yeah.  I goofed.  Thanks.

Kirk Haines