Skip to content

Instantly share code, notes, and snippets.

@phlipper
Created July 21, 2012 18:56
Show Gist options
  • Select an option

  • Save phlipper/3156805 to your computer and use it in GitHub Desktop.

Select an option

Save phlipper/3156805 to your computer and use it in GitHub Desktop.
Splat argument before required argument in Ruby 1.9
def foo(a, *b, c)
puts [a, b, c].inspect
end
foo(1, 2, 3, 4, 5)
# => [1, [2, 3, 4], 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment