Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created January 6, 2010 06:21
Show Gist options
  • Save patmaddox/270078 to your computer and use it in GitHub Desktop.
Save patmaddox/270078 to your computer and use it in GitHub Desktop.
module Kernel
def collate(*methods)
methods.collect {|m| send(m) }
end
end
first, last = User.collate :first, :last # => [#<User id: 1 name: "Pat">, #<User id: 85 name: "Joe">]
avg, max, min = [4, 3, 1, 5, 2].collate :avg, :max, :min # => [3.0, 5, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment