Skip to content

Instantly share code, notes, and snippets.

@nahurst
Created July 26, 2011 18:26
Show Gist options
  • Save nahurst/1107447 to your computer and use it in GitHub Desktop.
Save nahurst/1107447 to your computer and use it in GitHub Desktop.
Inject example
[1,2,3].inject([]) {|new_array, incoming_item| new_array << "item#{incoming_item}"}
# => ["item1", "item2", "item3"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment