Skip to content

Instantly share code, notes, and snippets.

@zentetsukenz
Created February 1, 2016 11:37
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 zentetsukenz/939fb38bdcaf5af10044 to your computer and use it in GitHub Desktop.
Save zentetsukenz/939fb38bdcaf5af10044 to your computer and use it in GitHub Desktop.
Sum array of object
array_of_objects.map { |object| object.field_to_sum }.inject(:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment