From: Rolf Gebauer Date: 2006-10-25T18:45:08+09:00 Subject: Re: '**' as hash splat? 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