Sha256: 2e270c11863e37d52838bb78478ab7b1590bc2165e1c2478c8be332682b41a94
Contents?: true
Size: 483 Bytes
Versions: 8
Compression:
Stored size: 483 Bytes
Contents
class Integer # Syntactic sugar to yield n times to a block. # # Return an array of any results. # # ==Example # 3.maps{rand} => [0.0248131784304143, 0.814666170190905, 0.15812816258206] # # ==Parallel to Integer#times # # Integer#maps is similar to Integer#times except that the output from each # call to the block is captured in an array element and that array is # returned to the calling code. def maps (0...self).map{|i| yield i} end end
Version data entries
8 entries across 8 versions & 1 rubygems