Skip to content

Instantly share code, notes, and snippets.

@mrzasa
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrzasa/cf189b681d39f73cc7b4 to your computer and use it in GitHub Desktop.
Save mrzasa/cf189b681d39f73cc7b4 to your computer and use it in GitHub Desktop.
Array wrap and splat
def print3(a,b,c)
puts "a: #{a}, b: #{b}, c:#{c}"
end
a = [1,2,3]
b = Array.new(3, 1)
c = Array.new(3) {|i| i*2}
print3(*a)
require 'active_support/core_ext/array'
e = 1
Array
[*x]
Array.wrap
h, *t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment