0047 Double_splat

The double splat operator for Hash

The double splat operator (or keyword splat) has been around since Ruby 2.0. It’s the equivalent of the splat operator but for Hash.

0047-double_splat_1.png

⚠️ There is a subtle difference with the splat operator. It doesn’t handle nil. Well, not yet, because after more than 10 years, it will in Ruby 3.4.0 (see Issue 20064).

0047-double_splat_2.png

Link to Ruby documentation for double splat operator