Skip to content

Instantly share code, notes, and snippets.

@elmariofredo
Created May 19, 2010 04:48
Show Gist options
  • Save elmariofredo/405963 to your computer and use it in GitHub Desktop.
Save elmariofredo/405963 to your computer and use it in GitHub Desktop.
# did not return nil exception
to_s >> to_splat. nil.to_splat
# Multiple splats allowed
def foo(*a)
a
end
foo(1, *[2,3], 4, *[5,6]) # => [1, 2, 3, 4, 5, 6]
a = [1,2,3]
b = [4,5,6]
[*a, *b] # => [1, 2, 3, 4, 5, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment