saasbook

each_with_index_answer.rb

May 1st, 2012
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.15 KB | None | 0 0
  1. module Enumerable
  2.   def each_with_custom_index(start,step)
  3.     self.each_with_index do |item,index|
  4.       yield item, start + step*index
  5.     end
  6.   end
  7. end
Advertisement
Add Comment
Please, Sign In to add comment