DEV Community

Discussion on: Today I learned about the splat operator in Ruby.

Collapse
 
swiknaba profile image
Lud
a = { foo: "bar" }

b = {
  bar: "baz",
  **a
}

puts b
> {
  bar: "baz",
  foo: "bar",
}
Enter fullscreen mode Exit fullscreen mode

;)