Skip to content

Instantly share code, notes, and snippets.

@chuck0523
Created May 16, 2016 13:33
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 chuck0523/026445664f9e7946831df97b69b00e35 to your computer and use it in GitHub Desktop.
Save chuck0523/026445664f9e7946831df97b69b00e35 to your computer and use it in GitHub Desktop.
array = [1, 2, 3]
puts [1, 1, 1].inject(array) {|sum_array, a| sum_array << a}
# [1, 1, 1, 1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment