Guest User

Untitled

a guest
May 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. # did not return nil exception
  2. to_s >> to_splat. nil.to_splat
  3.  
  4. # Multiple splats allowed
  5. def foo(*a)
  6. a
  7. end
  8. foo(1, *[2,3], 4, *[5,6]) # => [1, 2, 3, 4, 5, 6]
  9.  
  10. a = [1,2,3]
  11. b = [4,5,6]
  12. [*a, *b] # => [1, 2, 3, 4, 5, 6]
Add Comment
Please, Sign In to add comment