On Nov 5, 10:31=A0am, Trans <transf... / gmail.com> wrote:
> On Nov 5, 2:54=A0am, Jason Lillywhite <jason.lillywh... / gmail.com>
> wrote:
>
> > Thank you!
>
> > However, I am getting undefined method 'mash' even though I do require
> > 'facets/enumerable/mash'
>
> > am I missing something?
>
> Don't think so. It's working fine for me.
>
> What version of Ruby and Facets and what platform are you running?

For anyone who is interested, here's the definition (and some side
notes about how it evolved).

  def mash(&yld)
    if yld
      inject({}) do |h, *kv| # Used to be inject({}) do |h,kv|
        r =3D *yld[*kv]        # The *-op works different from to_a on
single element hash!!!
        nk, nv =3D *r          # Used to be nk, nv =3D
*yld[*kv].to_a.flatten
        h[nk] =3D nv
        h
      end
    else
      Enumerator.new(self,:mash)  # Used to be Hash[*self.to_a]
    end
  end

T.