module Cosmicrawler::Em

Public Class Methods

new(concurrency) click to toggle source
# File lib/cosmicrawler/em.rb, line 12
def initialize concurrency
  @concurrency = concurrency
end

Private Instance Methods

iterate(collection, &block) click to toggle source
# File lib/cosmicrawler/em.rb, line 17
def iterate collection, &block
  EventMachine.synchrony do
    EM::Synchrony::FiberIterator.new(collection, @concurrency).each do |item|
      block.call item
    end
    EM.stop_event_loop
  end #EventMachine.synchrony
  self
end