Skip to content

Instantly share code, notes, and snippets.

@kmdsbng
Created January 16, 2012 06:31
Show Gist options
  • Select an option

  • Save kmdsbng/1619408 to your computer and use it in GitHub Desktop.

Select an option

Save kmdsbng/1619408 to your computer and use it in GitHub Desktop.
Enumerable#to_proc
module Enumerable
def to_proc
proc { |obj, *args| self.map {|v| obj.send(v, *args)} }
end
end
["abc", "def"].map(&[:camelize, :upcase]) => [["Abc", "ABC"], ["Def", "DEF"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment