2007/8/9, dblack / rubypal.com <dblack / rubypal.com>:
> Hi --
>
> On Thu, 9 Aug 2007, Robert Klemme wrote:
>
> > # 2. alternative impl.
> > selection.things.
>
> I think you mean selection = things :-)
>
> >  inject({}) do |h,th|
> >    h[th.name] = h.has_key? th.name ? nil : th
>
> When I tried your code I found you need parens:
>
>    h[th.name] = h.has_key?(th.name) ? nil : th
>
> Otherwise it's like:
>
>    h[th.name] = h.has_key? (th.name ? nil : th)
>
> and you get [false, false, false, ...].

Good catches! Thanks!  /me confesses I did not try - just check for syntax. :-}

robert