Sha256: 6c0a03e1c81ad764ab73c86cb3bd2023689d6d982bedc95452c151c0dd5a7d5e
Contents?: true
Size: 481 Bytes
Versions: 10
Compression:
Stored size: 481 Bytes
Contents
module Enumerable # Send a message to each element and collect the result. # # [1,2,3].map_send(:+, 3) #=> [4,5,6] # # CREDIT: Sean O'Halpin def map_send(meth, *args, &block) map{|e| e.send(meth, *args, &block)} end #-- # Old defintion confused me ... # # def map_send(meth, *args) #:yield: # if block_given? # map{|e| yield(e.send(meth, *args))} # else # map{|e| e.send(meth, *args)} # end # end #++ end
Version data entries
10 entries across 9 versions & 2 rubygems