Created
October 26, 2011 15:26
-
-
Save mungruby/1316677 to your computer and use it in GitHub Desktop.
splat and unsplat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v1 = 'a' | |
v2 = 'b' | |
v3 = 'c' | |
def splat(*args) | |
puts 'splat' | |
puts args | |
args | |
end | |
def unsplat(i0, i1, i2) | |
puts 'unsplat' | |
puts i0 | |
puts i1 | |
puts i2 | |
end | |
unsplat(*splat(v1, v2, v3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No.