Rolf Gebauer schrieb:

> Trans schrieb:
>
> > We can:
> >
> >   a = [2,1]
> >   [3,*a]  #=> [3,2,1]
> >
> > How about:
> >
> >   h = {:b=>2, :a=>1}
> >   {:c => 3, **h}  #=> {:c=>3, :b=>2, :a=>1}
> >
> > T.
> we can do by using method Hash::[] instead of literal {}
>
> Hash[ :c, 3, *h ]  # => {:c=>3, [:a, 1]=>[:b, 2]}
>
>

sorry for (twice) rubbish
must be :
Hash[ :c, 3, *h.to_a.flatten ]  # => {:c=>3, [:a, 1]=>[:b, 2]}

 Rolf