代码:
[1] pry(main)> h = { a: 1, b: 2 }
=> {:a=>1, :b=>2}
[2] pry(main)> hh = { **h, c: 3 }
=> {:a=>1, :b=>2, :c=>3}
[3] pry(main)> hhh = { "a" => 1, "b" => 2 }
=> {"a"=>1, "b"=>2}
[4] pry(main)> hhhh = { **hhh, "c" => 3 }
TypeError: wrong argument type String (expected Symbol)
from (pry):4:in `__pry__'
[5] pry(main)>
ruby 2.x 增加了 keyword arguments, 而 **hash 也只是针对 keyword arguments 的。
http://stackoverflow.com/questions/25191747/why-does-double-splat-only-work-with-symbol-keys