class Integer

Please see README

Public Instance Methods

map() { |i| ... } click to toggle source

Syntactic sugar to yield n times to a block.

## Comparison 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.

@return an array of results

@example Generate an array of three random numbers

3.map{rand}
=> [0.0248131784304143, 0.814666170190905, 0.15812816258206]

@example Multiply the current index

3.map{|i| i * 2}
=> [0, 2, 4]
# File lib/sixarm_ruby_integer_map/integer/map.rb, line 25
def map
  self.times.map{|i| yield i}
end