Teach density to act like Fixnum#times with block args:


density 2 do |idx| # You may also pass a param to the block similar to n.times
  puts idx         # prints out 0, 1
  sleep 0.5        # sleep is 0.25s
end