Skip to content

Instantly share code, notes, and snippets.

@suginoy
Created June 28, 2012 07:22
Show Gist options
  • Save suginoy/3009658 to your computer and use it in GitHub Desktop.
Save suginoy/3009658 to your computer and use it in GitHub Desktop.
Calculate max size of nested array using inject method
[[1, 2], [1, 2, 4, 5], [3]].inject(0) { |r, i| r = i.size if i.size > r; r } # => 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment