public
Created

&method

  • Download Gist
amperstand.rb
Ruby
1 2 3 4 5 6
# From : http://andrewjgrimm.wordpress.com/2011/10/03/in-ruby-method-passes-you/
 
["1", "2", "3"].map(&method(:Integer))
 
filenames = ["a.txt", "b.txt", "c.txt"]
texts = filenames.map(&File.method(:read))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.