Skip to content

Instantly share code, notes, and snippets.

@dchelimsky
Forked from patmaddox/collate.rb
Created January 6, 2010 14:41
Show Gist options
  • Save dchelimsky/270307 to your computer and use it in GitHub Desktop.
Save dchelimsky/270307 to your computer and use it in GitHub Desktop.
module Kernel
def collate(*methods)
methods.inject({}) {|h,m| h[m] = send(m); h }
end
end
p [4, 3, 1, 5, 2].collate :max, :min
# => {:min=>1, :max=>5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment